aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages
diff options
context:
space:
mode:
authorBrett Smith <brettcsmith@brettcsmith.org>2012-03-17 17:53:00 -0400
committerBrett Smith <brettcsmith@brettcsmith.org>2012-03-17 17:53:00 -0400
commita0a7f87f625ca29ccddc123eb6540aa15a779eb7 (patch)
tree1b8eae477b57c91627095d5040644c26e1560716 /mediagoblin/user_pages
parent416b439fc883a570902edd094b44f310d66e849c (diff)
downloadmediagoblin-a0a7f87f625ca29ccddc123eb6540aa15a779eb7.tar.lz
mediagoblin-a0a7f87f625ca29ccddc123eb6540aa15a779eb7.tar.xz
mediagoblin-a0a7f87f625ca29ccddc123eb6540aa15a779eb7.zip
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.
Diffstat (limited to 'mediagoblin/user_pages')
-rw-r--r--mediagoblin/user_pages/views.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 530dea64..6eff684c 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -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)