summaryrefslogtreecommitdiff
path: root/helsinki.program/admin.py
diff options
context:
space:
mode:
Diffstat (limited to 'helsinki.program/admin.py')
-rw-r--r--helsinki.program/admin.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/helsinki.program/admin.py b/helsinki.program/admin.py
new file mode 100644
index 0000000..5a6ce7f
--- /dev/null
+++ b/helsinki.program/admin.py
@@ -0,0 +1,58 @@
+from django.contrib import admin
+
+from models import BroadcastFormat, MusicFocus, ShowInformation, ShowTopic, Host, Note, ProgramSlot, Show, TimeSlot
+
+class BroadcastFormatAdmin(admin.ModelAdmin):
+ list_display = ('format',)
+ prepopulated_fields = {'slug': ('format',)}
+
+class MusicFocusAdmin(admin.ModelAdmin):
+ list_display = ('focus', 'abbrev')
+ prepopulated_fields = {'slug': ('focus',)}
+
+class ShowInformationAdmin(admin.ModelAdmin):
+ list_display = ('information', 'abbrev')
+ prepopulated_fields = {'slug': ('information',)}
+
+class ShowTopicAdmin(admin.ModelAdmin):
+ list_display = ('topic', 'abbrev')
+ prepopulated_fields = {'slug': ('topic',)}
+
+class NoteAdmin(admin.ModelAdmin):
+ date_hierarchy = 'start'
+ list_display = ('title', 'show', 'status')
+ list_filter = ('status',)
+ ordering = ('timeslot',)
+
+class TimeSlotInline(admin.TabularInline):
+ model = TimeSlot
+
+class ProgramSlotAdmin(admin.ModelAdmin):
+ date_hierarchy = 'dstart'
+ inlines = (TimeSlotInline,)
+ list_display = ('show', 'byweekday', 'rrule', 'tstart', 'tend', 'dstart', 'until', 'timeslot_count')
+ list_filter = ('byweekday', 'rrule', 'is_repetition')
+ ordering = ('byweekday', 'dstart')
+ search_fields = ('show__name',)
+
+class ProgramSlotInline(admin.TabularInline):
+ model = ProgramSlot
+
+class ShowAdmin(admin.ModelAdmin):
+ filter_horizontal = ('hosts', 'owners', 'musicfocus', 'showinformation', 'showtopic')
+ inlines = (ProgramSlotInline,)
+ list_display = ('name', 'short_description', 'broadcastformat', 'has_active_programslots')
+ list_filter = ('broadcastformat', 'showinformation', 'showtopic', 'musicfocus',)
+ ordering = ('slug',)
+ prepopulated_fields = {'slug': ('name',)}
+ search_fields = ('name', 'short_description', 'description')
+
+admin.site.register(BroadcastFormat, BroadcastFormatAdmin)
+admin.site.register(MusicFocus, MusicFocusAdmin)
+admin.site.register(ShowInformation, ShowInformationAdmin)
+admin.site.register(ShowTopic, ShowTopicAdmin)
+admin.site.register(Note, NoteAdmin)
+admin.site.register(ProgramSlot, ProgramSlotAdmin)
+admin.site.register(Show, ShowAdmin)
+
+admin.site.register(Host) \ No newline at end of file