Don't save other file-owning models on delete, either

This commit is contained in:
Will Thompson 2016-02-26 11:14:11 +00:00 committed by j
parent 6e0049a20c
commit d69a8efd97
2 changed files with 4 additions and 4 deletions

View file

@ -536,7 +536,7 @@ class File(models.Model):
def delete_files(self): def delete_files(self):
if self.data: if self.data:
self.data.delete() self.data.delete(save=False)
self.streams.all().delete() self.streams.all().delete()
prefix = os.path.join(settings.MEDIA_ROOT, self.get_path('')) prefix = os.path.join(settings.MEDIA_ROOT, self.get_path(''))
if os.path.exists(prefix): if os.path.exists(prefix):
@ -634,7 +634,7 @@ class Frame(models.Model):
def delete_frame(sender, **kwargs): def delete_frame(sender, **kwargs):
f = kwargs['instance'] f = kwargs['instance']
if f.frame: if f.frame:
f.frame.delete() f.frame.delete(save=False)
pre_delete.connect(delete_frame, sender=Frame) pre_delete.connect(delete_frame, sender=Frame)
@ -780,5 +780,5 @@ class Stream(models.Model):
def delete_stream(sender, **kwargs): def delete_stream(sender, **kwargs):
f = kwargs['instance'] f = kwargs['instance']
if f.media: if f.media:
f.media.delete() f.media.delete(save=False)
pre_delete.connect(delete_stream, sender=Stream) pre_delete.connect(delete_stream, sender=Stream)

View file

@ -295,7 +295,7 @@ class Text(models.Model):
def delete_file(sender, **kwargs): def delete_file(sender, **kwargs):
t = kwargs['instance'] t = kwargs['instance']
if t.file: if t.file:
t.file.delete() t.file.delete(save=False)
pre_delete.connect(delete_file, sender=Text) pre_delete.connect(delete_file, sender=Text)
class Position(models.Model): class Position(models.Model):