When media is deleted, delete associated comments too.

The actual code is just a simple for loop; there might be a better
implementation but this is a fine start.  I also extended test_delete to
check this too.
This commit is contained in:
Brett Smith
2012-03-17 17:53:00 -04:00
parent 416b439fc8
commit a0a7f87f62
2 changed files with 19 additions and 0 deletions

View File

@@ -173,6 +173,10 @@ def media_confirm_delete(request, media):
if form.confirm.data is True:
username = media.get_uploader.username
# Delete all the associated comments
for comment in media.get_comments():
comment.delete()
# Delete all files on the public storage
delete_media_files(media)