Mercurial > public > sg101
comparison gpp/bio/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 | 152d77265da6 |
children | 8bbefaa3e408 |
comparison
equal
deleted
inserted
replaced
203:40e5903903e1 | 204:b4305e18d3af |
---|---|
2 This file contains the admin definitions for the bio application. | 2 This file contains the admin definitions for the bio application. |
3 """ | 3 """ |
4 import datetime | 4 import datetime |
5 | 5 |
6 from django.contrib import admin | 6 from django.contrib import admin |
7 from bio.models import UserProfile | 7 |
8 from bio.models import UserProfileFlag | |
9 import bio.models | 8 import bio.models |
10 from comments.models import Comment | 9 from comments.models import Comment |
11 from forums.tools import delete_user_posts | 10 from forums.tools import delete_user_posts |
11 | |
12 | |
13 class BadgeOwnerInline(admin.TabularInline): | |
14 model = bio.models.BadgeOwnership | |
15 extra = 1 | |
12 | 16 |
13 | 17 |
14 class UserProfileAdmin(admin.ModelAdmin): | 18 class UserProfileAdmin(admin.ModelAdmin): |
15 search_fields = ('user__username', 'user__first_name', 'user__last_name', | 19 search_fields = ('user__username', 'user__first_name', 'user__last_name', |
16 'user__email') | 20 'user__email') |
17 exclude = ('profile_html', 'signature_html') | 21 exclude = ('profile_html', 'signature_html') |
18 list_display = ('__unicode__', 'get_status_display', 'status_date') | 22 list_display = ('__unicode__', 'get_status_display', 'status_date') |
19 list_filter = ('status', ) | 23 list_filter = ('status', ) |
20 date_hierarchy = 'status_date' | 24 date_hierarchy = 'status_date' |
25 inlines = (BadgeOwnerInline, ) | |
21 actions = ( | 26 actions = ( |
22 'mark_active', | 27 'mark_active', |
23 'mark_resigned', | 28 'mark_resigned', |
24 'mark_removed', | 29 'mark_removed', |
25 'mark_suspended', | 30 'mark_suspended', |
91 | 96 |
92 class UserProfileFlagAdmin(admin.ModelAdmin): | 97 class UserProfileFlagAdmin(admin.ModelAdmin): |
93 list_display = ('__unicode__', 'flag_date', 'get_profile_url') | 98 list_display = ('__unicode__', 'flag_date', 'get_profile_url') |
94 | 99 |
95 | 100 |
96 admin.site.register(UserProfile, UserProfileAdmin) | 101 class BadgeAdmin(admin.ModelAdmin): |
97 admin.site.register(UserProfileFlag, UserProfileFlagAdmin) | 102 list_display = ('name', 'html', 'order', 'numeric_id', 'description') |
103 list_editable = ('order', 'numeric_id') | |
104 | |
105 | |
106 admin.site.register(bio.models.UserProfile, UserProfileAdmin) | |
107 admin.site.register(bio.models.UserProfileFlag, UserProfileFlagAdmin) | |
108 admin.site.register(bio.models.Badge, BadgeAdmin) |