Mercurial > public > sg101
annotate 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 |
rev | line source |
---|---|
gremmie@1 | 1 """This file contains the automatic admin site definitions for the accounts Models""" |
gremmie@1 | 2 |
gremmie@1 | 3 from django.contrib import admin |
gremmie@1 | 4 from accounts.models import IllegalUsername |
gremmie@1 | 5 from accounts.models import IllegalEmail |
gremmie@1 | 6 from accounts.models import PendingUser |
bgneal@347 | 7 from accounts import create_new_user |
bgneal@347 | 8 |
gremmie@1 | 9 |
gremmie@1 | 10 class PendingUserAdmin(admin.ModelAdmin): |
gremmie@1 | 11 list_display = ('username', 'email', 'date_joined') |
bgneal@347 | 12 actions = ('activate_account', ) |
bgneal@347 | 13 |
bgneal@347 | 14 def activate_account(self, request, qs): |
bgneal@347 | 15 """ |
bgneal@347 | 16 Activate the accounts of the selected pending users. |
bgneal@347 | 17 |
bgneal@347 | 18 """ |
bgneal@347 | 19 for pending_user in qs: |
bgneal@347 | 20 create_new_user(pending_user, admin_activation=True) |
bgneal@347 | 21 |
bgneal@347 | 22 activate_account.short_description = "Activate accounts for selected users" |
bgneal@347 | 23 |
gremmie@1 | 24 |
gremmie@1 | 25 admin.site.register(IllegalUsername) |
gremmie@1 | 26 admin.site.register(IllegalEmail) |
gremmie@1 | 27 admin.site.register(PendingUser, PendingUserAdmin) |