Mercurial > public > sg101
diff antispam/utils.py @ 780:feafa1c3d356
Issue #61, delete user photos when deactivating spammers.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 04 May 2014 15:18:26 -0500 |
parents | 08d905e38a86 |
children | 9e803323a0d0 |
line wrap: on
line diff
--- a/antispam/utils.py Sun May 04 13:45:27 2014 -0500 +++ b/antispam/utils.py Sun May 04 15:18:26 2014 -0500 @@ -11,6 +11,7 @@ from bio.models import STA_SUSPENDED, STA_SPAMMER from comments.models import Comment from forums.tools import delete_user_posts +from user_photos.s3 import delete_photos def contains_spam(s): @@ -96,6 +97,12 @@ # delete shouts user.shout_set.all().delete() + # delete any uploaded photos + photos = user.uploaded_photos.all() + if len(photos): + delete_photos(photos) + photos.delete() + logging.info("User deactivated for spam: %s", user.username)