comparison gpp/forums/admin.py @ 81:e356ea79a7a2

More work on forums. Committing what we got so far.
author Brian Neal <bgneal@gmail.com>
date Sun, 23 Aug 2009 00:14:52 +0000
parents 374b24dd2f9a
children 96eec1ed0fd3
comparison
equal deleted inserted replaced
80:a4fdc4d23b9e 81:e356ea79a7a2
9 from forums.models import Post 9 from forums.models import Post
10 10
11 11
12 class CategoryAdmin(admin.ModelAdmin): 12 class CategoryAdmin(admin.ModelAdmin):
13 list_display = ('name', 'position', ) 13 list_display = ('name', 'position', )
14 prepopulated_fields = { 'slug': ('name', ) }
15 save_on_top = True
14 16
15 17
16 class ForumAdmin(admin.ModelAdmin): 18 class ForumAdmin(admin.ModelAdmin):
17 list_display = ('name', 'category', 'position', 'topic_count', 'post_count') 19 list_display = ('name', 'category', 'position', 'topic_count', 'post_count')
18 prepopulated_fields = { 'slug': ('name', ) } 20 prepopulated_fields = { 'slug': ('name', ) }
19 raw_id_fields = ('last_post', ) 21 raw_id_fields = ('last_post', )
22 save_on_top = True
23
20 24
21 class TopicAdmin(admin.ModelAdmin): 25 class TopicAdmin(admin.ModelAdmin):
22 list_display = ('name', 'forum', 'creation_date', 'user', 'sticky', 'locked', 26 list_display = ('name', 'forum', 'creation_date', 'user', 'sticky', 'locked',
23 'post_count') 27 'post_count')
24 raw_id_fields = ('user', 'last_post', ) 28 raw_id_fields = ('user', 'last_post', )
25 search_fields = ('name', ) 29 search_fields = ('name', )
26 date_hierarchy = 'creation_date' 30 date_hierarchy = 'creation_date'
27 list_filter = ('creation_date', 'update_date', ) 31 list_filter = ('creation_date', 'update_date', )
32 save_on_top = True
28 33
29 34
30 class PostAdmin(admin.ModelAdmin): 35 class PostAdmin(admin.ModelAdmin):
31 list_display = ('topic', 'user', 'creation_date', 'update_date', 'summary') 36 list_display = ('topic', 'user', 'creation_date', 'update_date', 'summary')
32 raw_id_fields = ('topic', 'user', ) 37 raw_id_fields = ('topic', 'user', )
33 exclude = ('html', ) 38 exclude = ('html', )
34 search_fields = ('body', ) 39 search_fields = ('body', )
35 date_hierarchy = 'creation_date' 40 date_hierarchy = 'creation_date'
36 list_filter = ('creation_date', 'update_date', ) 41 list_filter = ('creation_date', 'update_date', )
42 save_on_top = True
37 43
38 44
39 admin.site.register(Category, CategoryAdmin) 45 admin.site.register(Category, CategoryAdmin)
40 admin.site.register(Forum, ForumAdmin) 46 admin.site.register(Forum, ForumAdmin)
41 admin.site.register(Topic, TopicAdmin) 47 admin.site.register(Topic, TopicAdmin)