class Good(models.Model):
def save(self, *args, **kwargs):
try:
this_record = Good.objects.get(id=self.id)
if this_record.thumbnail != self.thumbnail
this_record.thumbnail.delete(save=False)
except:
pass
super(Good, self).save(*args, **kwargs)
class Good(models.Model):
def save(self, *args, **kwargs):
self.thumbnail.delete(save=False)
super(Good, self).delete(*args, **kwargs)