Mercurial > public > sg101
changeset 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 | c740e097458f |
children | b6d6c9e37fae |
files | antispam/utils.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
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)