delete files when deleting ebookfiles
apparently the behavior changed after django 1.2. Anyway, we should delete files from s3 before we delete the referring objectpull/1/head
parent
3c94d49342
commit
ee0d19810c
|
@ -996,6 +996,7 @@ class Campaign(models.Model):
|
||||||
obsolete = Ebook.objects.filter(url=old_ebf.file.url)
|
obsolete = Ebook.objects.filter(url=old_ebf.file.url)
|
||||||
for eb in obsolete:
|
for eb in obsolete:
|
||||||
eb.deactivate()
|
eb.deactivate()
|
||||||
|
old_ebf.file.delete()
|
||||||
old_ebf.delete()
|
old_ebf.delete()
|
||||||
self.work.make_ebooks_from_ebfs(add_ask=True)
|
self.work.make_ebooks_from_ebfs(add_ask=True)
|
||||||
|
|
||||||
|
@ -1403,6 +1404,7 @@ class Work(models.Model):
|
||||||
done_formats.append(eb.format)
|
done_formats.append(eb.format)
|
||||||
null_files=EbookFile.objects.filter(edition__work=self, file='')
|
null_files=EbookFile.objects.filter(edition__work=self, file='')
|
||||||
for ebf in null_files:
|
for ebf in null_files:
|
||||||
|
ebf.file.delete()
|
||||||
ebf.delete()
|
ebf.delete()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue