diff gpp/accounts/admin.py @ 347:69d0306a6fe7

Fixing #165: add a way to filter users in the admin by join date; add an admin action to approve a pending user; added a honeypot type field to the registration form.
author Brian Neal <bgneal@gmail.com>
date Wed, 02 Mar 2011 01:11:32 +0000
parents dbd703f7d63a
children d1b11096595b
line wrap: on
line diff
--- a/gpp/accounts/admin.py	Mon Feb 28 03:53:04 2011 +0000
+++ b/gpp/accounts/admin.py	Wed Mar 02 01:11:32 2011 +0000
@@ -4,9 +4,23 @@
 from accounts.models import IllegalUsername
 from accounts.models import IllegalEmail
 from accounts.models import PendingUser
+from accounts import create_new_user
+
 
 class PendingUserAdmin(admin.ModelAdmin):
    list_display = ('username', 'email', 'date_joined')
+   actions = ('activate_account', )
+
+   def activate_account(self, request, qs):
+       """
+       Activate the accounts of the selected pending users.
+
+       """
+       for pending_user in qs:
+           create_new_user(pending_user, admin_activation=True)
+
+   activate_account.short_description = "Activate accounts for selected users"
+
 
 admin.site.register(IllegalUsername)
 admin.site.register(IllegalEmail)