annotate 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
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@75 14
bgneal@75 15
bgneal@75 16 class ForumAdmin(admin.ModelAdmin):
bgneal@75 17 list_display = ('name', 'category', 'position', 'topic_count', 'post_count')
bgneal@75 18 prepopulated_fields = { 'slug': ('name', ) }
bgneal@75 19 raw_id_fields = ('last_post', )
bgneal@75 20
bgneal@75 21 class TopicAdmin(admin.ModelAdmin):
bgneal@75 22 list_display = ('name', 'forum', 'creation_date', 'user', 'sticky', 'locked',
bgneal@75 23 'post_count')
bgneal@75 24 raw_id_fields = ('user', 'last_post', )
bgneal@75 25 search_fields = ('name', )
bgneal@75 26 date_hierarchy = 'creation_date'
bgneal@75 27 list_filter = ('creation_date', 'update_date', )
bgneal@75 28
bgneal@75 29
bgneal@75 30 class PostAdmin(admin.ModelAdmin):
bgneal@75 31 list_display = ('topic', 'user', 'creation_date', 'update_date', 'summary')
bgneal@75 32 raw_id_fields = ('topic', 'user', )
bgneal@75 33 exclude = ('html', )
bgneal@75 34 search_fields = ('body', )
bgneal@75 35 date_hierarchy = 'creation_date'
bgneal@75 36 list_filter = ('creation_date', 'update_date', )
bgneal@75 37
bgneal@75 38
bgneal@75 39 admin.site.register(Category, CategoryAdmin)
bgneal@75 40 admin.site.register(Forum, ForumAdmin)
bgneal@75 41 admin.site.register(Topic, TopicAdmin)
bgneal@75 42 admin.site.register(Post, PostAdmin)