it/itf/festival/admin.py
2012-03-28 16:20:07 +05:30

120 lines
3.7 KiB
Python
Executable File

from django.contrib import admin
from models import *
from markitup.widgets import MarkItUpWidget
from django.contrib.contenttypes import generic
from padmavideos.models import PadmaVideo
class AudioInline(admin.StackedInline):
model = Audio
extra = 2
class ImageInline(admin.StackedInline):
model = Image
extra = 3
class PadmaVideoInline(generic.GenericStackedInline):
model = PadmaVideo
extra = 3
class DocumentInline(admin.StackedInline):
model = Document
extra = 2
class MeetingPerformanceImageInline(admin.StackedInline):
model = MeetingPerformanceImage
extra = 3
class MeetingSponsorInline(admin.StackedInline):
model = MeetingSponsor
extra = 4
class TalkAdmin(admin.ModelAdmin):
inlines = [PadmaVideoInline, AudioInline, ImageInline, DocumentInline]
save_on_top = True
list_display = ('__unicode__', 'presenter', 'session',)
list_filter = ['session']
search_fields = ('title', 'intro', 'presenter',)
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
#hide meeting field
class MeetingDayInline(admin.StackedInline):
model = MeetingDay
extra = 3
class ParticipantInline(admin.StackedInline):
model = Participant
extra = 3
class MeetingAdmin(admin.ModelAdmin):
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
inlines = [MeetingDayInline, ImageInline, DocumentInline, ParticipantInline, MeetingSponsorInline]
prepopulated_fields = {"slug": ("title",)}
save_on_top = True
class MeetingPerformanceAdmin(admin.ModelAdmin):
inlines = [MeetingPerformanceImageInline]
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
search_fields = ('title', 'synopsis',)
save_on_top = True
class ProjectAdmin(admin.ModelAdmin):
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
prepopulated_fields = {"slug": ("title",)}
save_on_top = True
class SessionAdmin(admin.ModelAdmin):
# inlines = [PadmaVideoInline]
search_fields = ('title', 'intro',)
list_filter = ['day']
list_display = ('__unicode__',)
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
class ParticipantAdmin(admin.ModelAdmin):
search_fields = ('title', 'short_bio',)
list_display = ('name', 'title', 'meeting',)
list_filter = ['meeting']
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
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']
class DocumentAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'subject',)
list_editable = ('subject',)
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
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(PadmaVideo, PadmaVideoAdmin)
admin.site.register(Document, DocumentAdmin)
admin.site.register(DocumentSubject)
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(MeetingPerformance, MeetingPerformanceAdmin)
admin.site.register(CommentCaptcha)