annotate gpp/forums/admin.py @ 177:9b63ad1f2ad2

Fixing #59, again. Django ticket 13093 was fixed allowing cache_page to work in the URLconf.
author Brian Neal <bgneal@gmail.com>
date Mon, 15 Mar 2010 03:26:38 +0000
parents d97ceb95ce02
children 500e5875a306
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@113 11 from forums.models import TopicLastVisit
bgneal@75 12
bgneal@75 13
bgneal@75 14 class CategoryAdmin(admin.ModelAdmin):
bgneal@75 15 list_display = ('name', 'position', )
bgneal@81 16 prepopulated_fields = { 'slug': ('name', ) }
bgneal@81 17 save_on_top = True
bgneal@75 18
bgneal@75 19
bgneal@75 20 class ForumAdmin(admin.ModelAdmin):
bgneal@75 21 list_display = ('name', 'category', 'position', 'topic_count', 'post_count')
bgneal@75 22 prepopulated_fields = { 'slug': ('name', ) }
bgneal@75 23 raw_id_fields = ('last_post', )
bgneal@81 24 save_on_top = True
bgneal@81 25
bgneal@75 26
bgneal@75 27 class TopicAdmin(admin.ModelAdmin):
bgneal@102 28 list_display = ('name', 'forum', 'creation_date', 'update_date', 'user', 'sticky', 'locked',
bgneal@75 29 'post_count')
bgneal@75 30 raw_id_fields = ('user', 'last_post', )
bgneal@75 31 search_fields = ('name', )
bgneal@75 32 date_hierarchy = 'creation_date'
bgneal@75 33 list_filter = ('creation_date', 'update_date', )
bgneal@81 34 save_on_top = True
bgneal@75 35
bgneal@75 36
bgneal@75 37 class PostAdmin(admin.ModelAdmin):
bgneal@75 38 list_display = ('topic', 'user', 'creation_date', 'update_date', 'summary')
bgneal@75 39 raw_id_fields = ('topic', 'user', )
bgneal@75 40 exclude = ('html', )
bgneal@75 41 search_fields = ('body', )
bgneal@75 42 date_hierarchy = 'creation_date'
bgneal@75 43 list_filter = ('creation_date', 'update_date', )
bgneal@97 44 ordering = ('-creation_date', )
bgneal@81 45 save_on_top = True
bgneal@75 46
bgneal@75 47
bgneal@98 48 class FlaggedPostAdmin(admin.ModelAdmin):
bgneal@98 49 list_display = ('__unicode__', 'flag_date', 'get_post_url')
bgneal@98 50
bgneal@98 51
bgneal@113 52 class TopicLastVisitAdmin(admin.ModelAdmin):
bgneal@113 53 raw_id_fields = ('user', 'topic')
bgneal@113 54 list_display = ('user', 'topic', 'last_visit')
bgneal@113 55
bgneal@113 56
bgneal@75 57 admin.site.register(Category, CategoryAdmin)
bgneal@75 58 admin.site.register(Forum, ForumAdmin)
bgneal@75 59 admin.site.register(Topic, TopicAdmin)
bgneal@75 60 admin.site.register(Post, PostAdmin)
bgneal@98 61 admin.site.register(FlaggedPost, FlaggedPostAdmin)
bgneal@113 62 admin.site.register(TopicLastVisit, TopicLastVisitAdmin)