bgneal@75: """ bgneal@75: This file contains the admin definitions for the forums application. bgneal@75: """ bgneal@75: from django.contrib import admin bgneal@75: bgneal@75: from forums.models import Category bgneal@75: from forums.models import Forum bgneal@75: from forums.models import Topic bgneal@75: from forums.models import Post bgneal@75: bgneal@75: bgneal@75: class CategoryAdmin(admin.ModelAdmin): bgneal@75: list_display = ('name', 'position', ) bgneal@81: prepopulated_fields = { 'slug': ('name', ) } bgneal@81: save_on_top = True bgneal@75: bgneal@75: bgneal@75: class ForumAdmin(admin.ModelAdmin): bgneal@75: list_display = ('name', 'category', 'position', 'topic_count', 'post_count') bgneal@75: prepopulated_fields = { 'slug': ('name', ) } bgneal@75: raw_id_fields = ('last_post', ) bgneal@81: save_on_top = True bgneal@81: bgneal@75: bgneal@75: class TopicAdmin(admin.ModelAdmin): bgneal@75: list_display = ('name', 'forum', 'creation_date', 'user', 'sticky', 'locked', bgneal@75: 'post_count') bgneal@75: raw_id_fields = ('user', 'last_post', ) bgneal@75: search_fields = ('name', ) bgneal@75: date_hierarchy = 'creation_date' bgneal@75: list_filter = ('creation_date', 'update_date', ) bgneal@81: save_on_top = True bgneal@75: bgneal@75: bgneal@75: class PostAdmin(admin.ModelAdmin): bgneal@75: list_display = ('topic', 'user', 'creation_date', 'update_date', 'summary') bgneal@75: raw_id_fields = ('topic', 'user', ) bgneal@75: exclude = ('html', ) bgneal@75: search_fields = ('body', ) bgneal@75: date_hierarchy = 'creation_date' bgneal@75: list_filter = ('creation_date', 'update_date', ) bgneal@81: save_on_top = True bgneal@75: bgneal@75: bgneal@75: admin.site.register(Category, CategoryAdmin) bgneal@75: admin.site.register(Forum, ForumAdmin) bgneal@75: admin.site.register(Topic, TopicAdmin) bgneal@75: admin.site.register(Post, PostAdmin)