Mercurial > public > sg101
comparison gpp/bio/admin.py @ 207:8bbefaa3e408
Fix #79; user should get security pin when reporting profiles.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 03 May 2010 02:59:48 +0000 |
parents | b4305e18d3af |
children | 8c1832b9d815 |
comparison
equal
deleted
inserted
replaced
206:272d3a8c98e8 | 207:8bbefaa3e408 |
---|---|
4 import datetime | 4 import datetime |
5 | 5 |
6 from django.contrib import admin | 6 from django.contrib import admin |
7 | 7 |
8 import bio.models | 8 import bio.models |
9 import bio.badges | |
9 from comments.models import Comment | 10 from comments.models import Comment |
10 from forums.tools import delete_user_posts | 11 from forums.tools import delete_user_posts |
11 | 12 |
12 | 13 |
13 class BadgeOwnerInline(admin.TabularInline): | 14 class BadgeOwnerInline(admin.TabularInline): |
94 mark_spammer.short_description = "Mark selected users as spammers" | 95 mark_spammer.short_description = "Mark selected users as spammers" |
95 | 96 |
96 | 97 |
97 class UserProfileFlagAdmin(admin.ModelAdmin): | 98 class UserProfileFlagAdmin(admin.ModelAdmin): |
98 list_display = ('__unicode__', 'flag_date', 'get_profile_url') | 99 list_display = ('__unicode__', 'flag_date', 'get_profile_url') |
100 actions = ('accept_flags', ) | |
101 | |
102 def accept_flags(self, request, qs): | |
103 """This action awards a security pin to the user that reported the | |
104 profile and then deletes the flag. | |
105 """ | |
106 for flag in qs: | |
107 bio.badges.award_badge(bio.badges.SECURITY_PIN, flag.user) | |
108 flag.delete() | |
109 | |
110 accept_flags.short_description = "Accept selected flagged profiles" | |
111 | |
112 | |
113 | |
99 | 114 |
100 | 115 |
101 class BadgeAdmin(admin.ModelAdmin): | 116 class BadgeAdmin(admin.ModelAdmin): |
102 list_display = ('name', 'html', 'order', 'numeric_id', 'description') | 117 list_display = ('name', 'html', 'order', 'numeric_id', 'description') |
103 list_editable = ('order', 'numeric_id') | 118 list_editable = ('order', 'numeric_id') |