diff antispam/utils.py @ 625:08d905e38a86

For issue 23, clear spammer profile fields, shouts, & elsewhere links upon deactivation.
author Brian Neal <bgneal@gmail.com>
date Thu, 01 Nov 2012 19:35:30 -0500
parents 8ddd6490cbc9
children feafa1c3d356
line wrap: on
line diff
--- a/antispam/utils.py	Wed Oct 31 20:23:12 2012 -0500
+++ b/antispam/utils.py	Thu Nov 01 19:35:30 2012 -0500
@@ -79,14 +79,23 @@
     profile = user.get_profile()
     profile.status = STA_SPAMMER
     profile.status_date = datetime.datetime.now()
-    profile.reset_text_fields()
+    profile.reset()
     if profile.avatar:
         profile.avatar.delete(save=False)
     profile.save()
 
+    # delete comments & forum posts
     Comment.objects.filter(user=user).delete()
     delete_user_posts(user)
 
+    # delete elsewhere links
+    user.social_network_profiles.all().delete()
+    user.instant_messenger_profiles.all().delete()
+    user.website_profiles.all().delete()
+
+    # delete shouts
+    user.shout_set.all().delete()
+
     logging.info("User deactivated for spam: %s", user.username)