summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/admin.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/program/admin.py b/program/admin.py
index b50e14f..cec7857 100644
--- a/program/admin.py
+++ b/program/admin.py
@@ -1,7 +1,10 @@
from django.contrib import admin
+from django.utils.translation import ugettext_lazy as _
from models import BroadcastFormat, MusicFocus, ShowInformation, ShowTopic, Host, Note, ProgramSlot, Show, TimeSlot
+from datetime import date
+
class BroadcastFormatAdmin(admin.ModelAdmin):
list_display = ('format',)
prepopulated_fields = {'slug': ('format',)}
@@ -46,7 +49,13 @@ class TimeSlotInline(admin.TabularInline):
model = TimeSlot
readonly_fields = ('start', 'end')
+def renew(modeladmin, request, queryset):
+ next_year = date.today().year+1
+ queryset.update(until=date(next_year, 12, 31))
+renew.short_description = _("Renew selected time slots")
+
class ProgramSlotAdmin(admin.ModelAdmin):
+ actions = (renew,)
inlines = (TimeSlotInline,)
list_display = ('show', 'byweekday', 'rrule', 'tstart', 'tend', 'dstart', 'until', 'timeslot_count')
list_filter = ('byweekday', 'rrule', 'is_repetition')