annotate gpp/forums/admin.py @ 112:d1b0b86441c0

Forums: added a sync() function on the forum model. Created javascript for the moderate forum function to drive the master topic select checkbox.
author Brian Neal <bgneal@gmail.com>
date Wed, 30 Sep 2009 00:42:13 +0000
parents e67c4dd98db5
children d97ceb95ce02
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@98 10 from forums.models import FlaggedPost
bgneal@75 11
bgneal@75 12
bgneal@75 13 class CategoryAdmin(admin.ModelAdmin):
bgneal@75 14 list_display = ('name', 'position', )
bgneal@81 15 prepopulated_fields = { 'slug': ('name', ) }
bgneal@81 16 save_on_top = True
bgneal@75 17
bgneal@75 18
bgneal@75 19 class ForumAdmin(admin.ModelAdmin):
bgneal@75 20 list_display = ('name', 'category', 'position', 'topic_count', 'post_count')
bgneal@75 21 prepopulated_fields = { 'slug': ('name', ) }
bgneal@75 22 raw_id_fields = ('last_post', )
bgneal@81 23 save_on_top = True
bgneal@81 24
bgneal@75 25
bgneal@75 26 class TopicAdmin(admin.ModelAdmin):
bgneal@102 27 list_display = ('name', 'forum', 'creation_date', 'update_date', 'user', 'sticky', 'locked',
bgneal@75 28 'post_count')
bgneal@75 29 raw_id_fields = ('user', 'last_post', )
bgneal@75 30 search_fields = ('name', )
bgneal@75 31 date_hierarchy = 'creation_date'
bgneal@75 32 list_filter = ('creation_date', 'update_date', )
bgneal@81 33 save_on_top = True
bgneal@75 34
bgneal@75 35
bgneal@75 36 class PostAdmin(admin.ModelAdmin):
bgneal@75 37 list_display = ('topic', 'user', 'creation_date', 'update_date', 'summary')
bgneal@75 38 raw_id_fields = ('topic', 'user', )
bgneal@75 39 exclude = ('html', )
bgneal@75 40 search_fields = ('body', )
bgneal@75 41 date_hierarchy = 'creation_date'
bgneal@75 42 list_filter = ('creation_date', 'update_date', )
bgneal@97 43 ordering = ('-creation_date', )
bgneal@81 44 save_on_top = True
bgneal@75 45
bgneal@75 46
bgneal@98 47 class FlaggedPostAdmin(admin.ModelAdmin):
bgneal@98 48 list_display = ('__unicode__', 'flag_date', 'get_post_url')
bgneal@98 49
bgneal@98 50
bgneal@75 51 admin.site.register(Category, CategoryAdmin)
bgneal@75 52 admin.site.register(Forum, ForumAdmin)
bgneal@75 53 admin.site.register(Topic, TopicAdmin)
bgneal@75 54 admin.site.register(Post, PostAdmin)
bgneal@98 55 admin.site.register(FlaggedPost, FlaggedPostAdmin)