changeset 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 272d3a8c98e8
children 2022c0409296
files gpp/bio/admin.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/bio/admin.py	Mon May 03 02:49:31 2010 +0000
+++ b/gpp/bio/admin.py	Mon May 03 02:59:48 2010 +0000
@@ -6,6 +6,7 @@
 from django.contrib import admin
 
 import bio.models
+import bio.badges
 from comments.models import Comment
 from forums.tools import delete_user_posts
 
@@ -96,6 +97,20 @@
 
 class UserProfileFlagAdmin(admin.ModelAdmin):
     list_display = ('__unicode__', 'flag_date', 'get_profile_url')
+    actions = ('accept_flags', )
+
+    def accept_flags(self, request, qs):
+        """This action awards a security pin to the user that reported the
+        profile and then deletes the flag.
+        """
+        for flag in qs:
+            bio.badges.award_badge(bio.badges.SECURITY_PIN, flag.user)
+            flag.delete()
+
+    accept_flags.short_description = "Accept selected flagged profiles"
+
+
+
 
 
 class BadgeAdmin(admin.ModelAdmin):