Merge pull request #568 from Gluejar/really-delete-ebook-files

delete files when deleting ebookfiles
pull/1/head
Raymond Yee 2016-05-10 17:46:31 -07:00
commit cc9b4ed7c0
1 changed files with 2 additions and 0 deletions

View File

@ -996,6 +996,7 @@ class Campaign(models.Model):
obsolete = Ebook.objects.filter(url=old_ebf.file.url)
for eb in obsolete:
eb.deactivate()
old_ebf.file.delete()
old_ebf.delete()
self.work.make_ebooks_from_ebfs(add_ask=True)
@ -1403,6 +1404,7 @@ class Work(models.Model):
done_formats.append(eb.format)
null_files=EbookFile.objects.filter(edition__work=self, file='')
for ebf in null_files:
ebf.file.delete()
ebf.delete()
@property