1class ImageQuerySet(models.QuerySet):
2
3 def delete(self, *args, **kwargs):
4 for obj in self:
5 obj.img.delete()
6 super(ImageQuerySet, self).delete(*args, **kwargs)
7
8class Image(models.Model):
9 objects = ImageQuerySet.as_manager()
10 img = models.ImageField(upload_to=get_image_path)
11 ...
12 def delete(self, *args, **kwargs):
13 self.img.delete()
14 super(Image, self).delete(*args, **kwargs)
15