comparison 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
comparison
equal deleted inserted replaced
624:5d79b09aa52b 625:08d905e38a86
77 user.save() 77 user.save()
78 78
79 profile = user.get_profile() 79 profile = user.get_profile()
80 profile.status = STA_SPAMMER 80 profile.status = STA_SPAMMER
81 profile.status_date = datetime.datetime.now() 81 profile.status_date = datetime.datetime.now()
82 profile.reset_text_fields() 82 profile.reset()
83 if profile.avatar: 83 if profile.avatar:
84 profile.avatar.delete(save=False) 84 profile.avatar.delete(save=False)
85 profile.save() 85 profile.save()
86 86
87 # delete comments & forum posts
87 Comment.objects.filter(user=user).delete() 88 Comment.objects.filter(user=user).delete()
88 delete_user_posts(user) 89 delete_user_posts(user)
90
91 # delete elsewhere links
92 user.social_network_profiles.all().delete()
93 user.instant_messenger_profiles.all().delete()
94 user.website_profiles.all().delete()
95
96 # delete shouts
97 user.shout_set.all().delete()
89 98
90 logging.info("User deactivated for spam: %s", user.username) 99 logging.info("User deactivated for spam: %s", user.username)
91 100
92 101
93 def _get_spam_phrases(): 102 def _get_spam_phrases():