annotate 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
rev   line source
bgneal@75 1 """
bgneal@75 2 This file contains the admin definitions for the forums application.
bgneal@75 3 """
bgneal@75 4 from django.contrib import admin
bgneal@75 5
bgneal@75 6 from forums.models import Category
bgneal@75 7 from forums.models import Forum
bgneal@75 8 from forums.models import Topic
bgneal@75 9 from forums.models import Post
bgneal@75 10
bgneal@75 11
bgneal@75 12 class CategoryAdmin(admin.ModelAdmin):
bgneal@75 13 list_display = ('name', 'position', )
bgneal@81 14 prepopulated_fields = { 'slug': ('name', ) }
bgneal@81 15 save_on_top = True
bgneal@75 16
bgneal@75 17
bgneal@75 18 class ForumAdmin(admin.ModelAdmin):
bgneal@75 19 list_display = ('name', 'category', 'position', 'topic_count', 'post_count')
bgneal@75 20 prepopulated_fields = { 'slug': ('name', ) }
bgneal@75 21 raw_id_fields = ('last_post', )
bgneal@81 22 save_on_top = True
bgneal@81 23
bgneal@75 24
bgneal@75 25 class TopicAdmin(admin.ModelAdmin):
bgneal@75 26 list_display = ('name', 'forum', 'creation_date', 'user', 'sticky', 'locked',
bgneal@75 27 'post_count')
bgneal@75 28 raw_id_fields = ('user', 'last_post', )
bgneal@75 29 search_fields = ('name', )
bgneal@75 30 date_hierarchy = 'creation_date'
bgneal@75 31 list_filter = ('creation_date', 'update_date', )
bgneal@81 32 save_on_top = True
bgneal@75 33
bgneal@75 34
bgneal@75 35 class PostAdmin(admin.ModelAdmin):
bgneal@75 36 list_display = ('topic', 'user', 'creation_date', 'update_date', 'summary')
bgneal@75 37 raw_id_fields = ('topic', 'user', )
bgneal@75 38 exclude = ('html', )
bgneal@75 39 search_fields = ('body', )
bgneal@75 40 date_hierarchy = 'creation_date'
bgneal@75 41 list_filter = ('creation_date', 'update_date', )
bgneal@81 42 save_on_top = True
bgneal@75 43
bgneal@75 44
bgneal@75 45 admin.site.register(Category, CategoryAdmin)
bgneal@75 46 admin.site.register(Forum, ForumAdmin)
bgneal@75 47 admin.site.register(Topic, TopicAdmin)
bgneal@75 48 admin.site.register(Post, PostAdmin)