summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-12-28 15:32:23 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-12-28 15:32:23 (GMT)
commit15e7ce4196b590f8e7abdf9fecde40d657ce4e5a (patch)
tree9432d389ade0fcad8d63b888b311fbfd05f6f94a /program
parent60444ceef7e2ec680c222e69ca039dc9b5714471 (diff)
added renew action to TimeSlot admin
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')