diff gpp/gcalendar/admin.py @ 204:b4305e18d3af

Resolve ticket #74. Add user badges. Some extra credit was done here: also refactored how pending news, links, and downloads are handled.
author Brian Neal <bgneal@gmail.com>
date Sat, 01 May 2010 21:53:59 +0000
parents bc657962941e
children d77e0dc772ad
line wrap: on
line diff
--- a/gpp/gcalendar/admin.py	Wed Apr 28 03:00:31 2010 +0000
+++ b/gpp/gcalendar/admin.py	Sat May 01 21:53:59 2010 +0000
@@ -7,6 +7,7 @@
 
 from gcalendar.models import Event
 from gcalendar.admin_views import google_sync
+import bio.badges
 
 
 class EventAdmin(admin.ModelAdmin):
@@ -47,6 +48,9 @@
                 event.save()
                 count += 1
 
+                if event.status == Event.NEW_APRV:
+                    bio.badges.award_badge(bio.badges.CALENDAR_PIN, event.user)
+
         msg = "1 event was" if count == 1 else "%d events were" % count
         msg += " approved."
         self.message_user(request, msg)