comparison 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
comparison
equal deleted inserted replaced
346:efa3b4901777 347:69d0306a6fe7
2 2
3 from django.contrib import admin 3 from django.contrib import admin
4 from accounts.models import IllegalUsername 4 from accounts.models import IllegalUsername
5 from accounts.models import IllegalEmail 5 from accounts.models import IllegalEmail
6 from accounts.models import PendingUser 6 from accounts.models import PendingUser
7 from accounts import create_new_user
8
7 9
8 class PendingUserAdmin(admin.ModelAdmin): 10 class PendingUserAdmin(admin.ModelAdmin):
9 list_display = ('username', 'email', 'date_joined') 11 list_display = ('username', 'email', 'date_joined')
12 actions = ('activate_account', )
13
14 def activate_account(self, request, qs):
15 """
16 Activate the accounts of the selected pending users.
17
18 """
19 for pending_user in qs:
20 create_new_user(pending_user, admin_activation=True)
21
22 activate_account.short_description = "Activate accounts for selected users"
23
10 24
11 admin.site.register(IllegalUsername) 25 admin.site.register(IllegalUsername)
12 admin.site.register(IllegalEmail) 26 admin.site.register(IllegalEmail)
13 admin.site.register(PendingUser, PendingUserAdmin) 27 admin.site.register(PendingUser, PendingUserAdmin)