it/itf/festival/admin.py

120 lines
3.7 KiB
Python
Raw Normal View History

2010-03-03 14:28:00 +00:00
from django.contrib import admin
from models import *
2011-12-01 21:11:11 +00:00
from markitup.widgets import MarkItUpWidget
2012-03-27 20:28:28 +00:00
from django.contrib.contenttypes import generic
from padmavideos.models import PadmaVideo, PadmaClip
2010-03-03 14:28:00 +00:00
class AudioInline(admin.StackedInline):
model = Audio
extra = 2
class ImageInline(admin.StackedInline):
model = Image
extra = 3
2012-03-27 20:28:28 +00:00
class PadmaVideoInline(generic.GenericStackedInline):
model = PadmaClip
2010-05-14 02:33:11 +00:00
extra = 3
2010-03-03 14:28:00 +00:00
class DocumentInline(admin.StackedInline):
model = Document
extra = 2
2012-03-04 07:36:53 +00:00
class MeetingPerformanceImageInline(admin.StackedInline):
model = MeetingPerformanceImage
extra = 3
2012-03-09 07:07:44 +00:00
class MeetingSponsorInline(admin.StackedInline):
model = MeetingSponsor
extra = 4
2010-05-14 02:33:11 +00:00
2010-03-03 14:28:00 +00:00
class TalkAdmin(admin.ModelAdmin):
2012-03-28 10:50:07 +00:00
inlines = [PadmaVideoInline, AudioInline, ImageInline, DocumentInline]
2010-03-03 14:28:00 +00:00
save_on_top = True
list_display = ('__unicode__', 'presenter', 'session',)
list_filter = ['session']
search_fields = ('title', 'intro', 'presenter',)
2011-12-01 21:11:11 +00:00
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
2010-03-03 14:28:00 +00:00
#hide meeting field
class MeetingDayInline(admin.StackedInline):
model = MeetingDay
extra = 3
class ParticipantInline(admin.StackedInline):
model = Participant
extra = 3
class MeetingAdmin(admin.ModelAdmin):
2011-12-01 21:11:11 +00:00
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
2012-03-09 07:07:44 +00:00
inlines = [MeetingDayInline, ImageInline, DocumentInline, ParticipantInline, MeetingSponsorInline]
2010-03-03 14:28:00 +00:00
prepopulated_fields = {"slug": ("title",)}
save_on_top = True
2012-03-04 07:36:53 +00:00
class MeetingPerformanceAdmin(admin.ModelAdmin):
inlines = [MeetingPerformanceImageInline]
2012-03-08 11:38:41 +00:00
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
2012-03-04 07:36:53 +00:00
search_fields = ('title', 'synopsis',)
save_on_top = True
2010-03-03 14:28:00 +00:00
class ProjectAdmin(admin.ModelAdmin):
2011-12-01 21:11:11 +00:00
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
2010-03-03 14:28:00 +00:00
prepopulated_fields = {"slug": ("title",)}
save_on_top = True
class SessionAdmin(admin.ModelAdmin):
2012-03-28 10:50:07 +00:00
# inlines = [PadmaVideoInline]
2010-03-03 14:28:00 +00:00
search_fields = ('title', 'intro',)
list_filter = ['day']
list_display = ('__unicode__',)
2011-12-01 21:11:11 +00:00
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
2010-03-03 14:28:00 +00:00
class ParticipantAdmin(admin.ModelAdmin):
search_fields = ('title', 'short_bio',)
list_display = ('name', 'title', 'meeting',)
list_filter = ['meeting']
2011-12-01 21:16:07 +00:00
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
2010-03-03 14:28:00 +00:00
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',)
2011-12-13 20:49:15 +00:00
formfield_overrides = {models.TextField: {'widget': MarkItUpWidget}}
2010-03-03 14:28:00 +00:00
admin.site.register(Comment, CommentAdmin)
admin.site.register(Meeting, MeetingAdmin)
admin.site.register(Audio, AudioAdmin)
admin.site.register(Video, VideoAdmin)
2010-05-14 02:33:11 +00:00
admin.site.register(Image, ImageAdmin)
2012-03-27 20:28:28 +00:00
#admin.site.register(PadmaVideo, PadmaVideoAdmin)
admin.site.register(Document, DocumentAdmin)
2011-11-23 16:04:21 +00:00
admin.site.register(DocumentSubject)
2010-03-03 14:28:00 +00:00
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)
2012-03-04 07:36:53 +00:00
admin.site.register(MeetingPerformance, MeetingPerformanceAdmin)
2010-03-03 14:28:00 +00:00
admin.site.register(CommentCaptcha)