comparison gpp/forums/admin.py @ 75:374b24dd2f9a

First checkin of forums. Have noticed cascading delete behavior. Will try to prevent this next.
author Brian Neal <bgneal@gmail.com>
date Sun, 05 Jul 2009 00:03:40 +0000
parents
children e356ea79a7a2
comparison
equal deleted inserted replaced
74:df56795771a6 75:374b24dd2f9a
1 """
2 This file contains the admin definitions for the forums application.
3 """
4 from django.contrib import admin
5
6 from forums.models import Category
7 from forums.models import Forum
8 from forums.models import Topic
9 from forums.models import Post
10
11
12 class CategoryAdmin(admin.ModelAdmin):
13 list_display = ('name', 'position', )
14
15
16 class ForumAdmin(admin.ModelAdmin):
17 list_display = ('name', 'category', 'position', 'topic_count', 'post_count')
18 prepopulated_fields = { 'slug': ('name', ) }
19 raw_id_fields = ('last_post', )
20
21 class TopicAdmin(admin.ModelAdmin):
22 list_display = ('name', 'forum', 'creation_date', 'user', 'sticky', 'locked',
23 'post_count')
24 raw_id_fields = ('user', 'last_post', )
25 search_fields = ('name', )
26 date_hierarchy = 'creation_date'
27 list_filter = ('creation_date', 'update_date', )
28
29
30 class PostAdmin(admin.ModelAdmin):
31 list_display = ('topic', 'user', 'creation_date', 'update_date', 'summary')
32 raw_id_fields = ('topic', 'user', )
33 exclude = ('html', )
34 search_fields = ('body', )
35 date_hierarchy = 'creation_date'
36 list_filter = ('creation_date', 'update_date', )
37
38
39 admin.site.register(Category, CategoryAdmin)
40 admin.site.register(Forum, ForumAdmin)
41 admin.site.register(Topic, TopicAdmin)
42 admin.site.register(Post, PostAdmin)