comparison accounts/admin.py @ 581:ee87ea74d46b

For Django 1.4, rearranged project structure for new manage.py.
author Brian Neal <bgneal@gmail.com>
date Sat, 05 May 2012 17:10:48 -0500
parents gpp/accounts/admin.py@d1b11096595b
children
comparison
equal deleted inserted replaced
580:c525f3e0b5d0 581:ee87ea74d46b
1 """This file contains the automatic admin site definitions for the accounts Models"""
2
3 from django.contrib import admin
4 from accounts.models import IllegalUsername
5 from accounts.models import IllegalEmail
6 from accounts.models import PendingUser
7 from accounts import create_new_user
8
9
10 class PendingUserAdmin(admin.ModelAdmin):
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 self.message_user(request, "%s accounts activated" % qs.count())
23
24 activate_account.short_description = "Activate accounts for selected users"
25
26
27 admin.site.register(IllegalUsername)
28 admin.site.register(IllegalEmail)
29 admin.site.register(PendingUser, PendingUserAdmin)