Mercurial > public > sg101
diff gpp/bio/admin.py @ 215:8c1832b9d815
Implement #84; additional checks on spammers; implement stranger status.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 29 May 2010 04:51:28 +0000 |
parents | 8bbefaa3e408 |
children | d424b8bae71d |
line wrap: on
line diff
--- a/gpp/bio/admin.py Fri May 14 02:19:48 2010 +0000 +++ b/gpp/bio/admin.py Sat May 29 04:51:28 2010 +0000 @@ -20,7 +20,8 @@ search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email') exclude = ('profile_html', 'signature_html') - list_display = ('__unicode__', 'get_status_display', 'status_date') + list_display = ('__unicode__', 'user_is_active', 'get_status_display', 'status_date') + readonly_fields = ('status', 'status_date') list_filter = ('status', ) date_hierarchy = 'status_date' inlines = (BadgeOwnerInline, ) @@ -30,6 +31,7 @@ 'mark_removed', 'mark_suspended', 'mark_spammer', + 'mark_stranger', ) def get_status_display(self, obj): @@ -44,7 +46,8 @@ """ now = datetime.datetime.now() for profile in qs: - profile.user.is_active = status == bio.models.STA_ACTIVE + profile.user.is_active = (status == bio.models.STA_ACTIVE or + status == bio.models.STA_STRANGER) profile.user.save() profile.status = status profile.status_date = now @@ -94,6 +97,13 @@ delete_user_posts(profile.user) mark_spammer.short_description = "Mark selected users as spammers" + def mark_stranger(self, request, qs): + """ + Marks users as strangers. Updates their profile status to STA_STRANGER. + """ + self.mark_user_status(request, qs, bio.models.STA_STRANGER) + mark_stranger.short_description = "Mark selected users as strangers" + class UserProfileFlagAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'flag_date', 'get_profile_url')