from django.contrib import admin from models import * class AudioInline(admin.StackedInline): model = Audio extra = 2 class ImageInline(admin.StackedInline): model = Image extra = 3 class DocumentInline(admin.StackedInline): model = Document extra = 2 class TalkAdmin(admin.ModelAdmin): inlines = [AudioInline, ImageInline, DocumentInline] save_on_top = True list_display = ('__unicode__', 'presenter', 'session',) list_filter = ['session'] search_fields = ('title', 'intro', 'presenter',) #hide meeting field class MeetingDayInline(admin.StackedInline): model = MeetingDay extra = 3 class ParticipantInline(admin.StackedInline): model = Participant extra = 3 class MeetingAdmin(admin.ModelAdmin): inlines = [MeetingDayInline, ImageInline, DocumentInline, ParticipantInline] prepopulated_fields = {"slug": ("title",)} save_on_top = True class ProjectAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("title",)} save_on_top = True class SessionAdmin(admin.ModelAdmin): search_fields = ('title', 'intro',) list_filter = ['day'] list_display = ('__unicode__',) class ParticipantAdmin(admin.ModelAdmin): search_fields = ('title', 'short_bio',) list_display = ('name', 'title', 'meeting',) list_filter = ['meeting'] class CommentAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'is_displayed',) list_editable = ('is_displayed',) list_filter = ['meeting'] class SignupAdmin(admin.ModelAdmin): search_fields = ('email',) class ImageAdmin(admin.ModelAdmin): search_fields = ('title', 'intro',) list_filter = ['meeting', 'talk'] class AudioAdmin(admin.ModelAdmin): search_fields = ('title', 'intro',) list_filter = ['meeting', 'talk'] class VideoAdmin(admin.ModelAdmin): search_fields = ('title', 'intro',) list_filter = ['meeting', 'talk'] admin.site.register(Comment, CommentAdmin) admin.site.register(Meeting, MeetingAdmin) admin.site.register(Audio, AudioAdmin) admin.site.register(Video, VideoAdmin) admin.site.register(Image, ImageAdmin) admin.site.register(Document) admin.site.register(Project, ProjectAdmin) #admin.site.register(MeetingDay) admin.site.register(Session, SessionAdmin) admin.site.register(Talk, TalkAdmin) admin.site.register(Participant, ParticipantAdmin) admin.site.register(Signup, SignupAdmin) admin.site.register(CommentCaptcha)