summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--program/views.py22
-rw-r--r--templates/program/current.html22
-rw-r--r--templates/program/current_box.html39
3 files changed, 57 insertions, 26 deletions
diff --git a/program/views.py b/program/views.py
index 10d193b..23c1483 100644
--- a/program/views.py
+++ b/program/views.py
@@ -1,6 +1,5 @@
from django.views.generic.list import ListView
from django.views.generic.base import TemplateView
-from django.views.generic.dates import DayArchiveView, TodayArchiveView, WeekArchiveView
from django.shortcuts import get_object_or_404
from models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic, TimeSlot
@@ -60,9 +59,16 @@ class TodayScheduleView(TemplateView):
today = datetime.combine(date.today(), time(6, 0))
tomorrow = datetime.combine(date.today()+timedelta(days=1), time(6, 0))
+ context['day'] = today
context['broadcastformats'] = BroadcastFormat.objects.all()
context['recommendations'] = Note.objects.filter(status=1, timeslot__start__range=(now, tomorrow))
- context['timeslots'] = TimeSlot.objects.filter(start__range=(today, tomorrow))
+
+ if 'broadcastformat' in self.request.GET:
+ broadcastformat = get_object_or_404(BroadcastFormat, slug=self.request.GET['broadcastformat'])
+
+ context['timeslots'] = TimeSlot.objects.filter(start__range=(today, tomorrow), show__broadcastformat=broadcastformat)
+ else:
+ context['timeslots'] = TimeSlot.objects.filter(start__range=(today, tomorrow))
return context
@@ -80,13 +86,21 @@ class DayScheduleView(TemplateView):
this_day = datetime.strptime('%s__%s__%s__06__00' % (year, month, day), '%Y__%m__%d__%H__%M')
that_day = this_day+timedelta(days=1)
+ context['day'] = this_day
context['broadcastformats'] = BroadcastFormat.objects.all()
context['recommendations'] = Note.objects.filter(status=1, timeslot__start__range=(this_day, that_day))
- context['timeslots'] = TimeSlot.objects.filter(start__range=(this_day, that_day))
+
+ if 'broadcastformat' in self.request.GET:
+ broadcastformat = get_object_or_404(BroadcastFormat, slug=self.request.GET['broadcastformat'])
+
+ context['timeslots'] = TimeSlot.objects.filter(start__range=(this_day, that_day), show__broadcastformat=broadcastformat)
+ else:
+ context['timeslots'] = TimeSlot.objects.filter(start__range=(this_day, that_day))
+
return context
class CurrentShowView(TemplateView):
- template_name = 'program/current.html'
+ template_name = 'program/current_box.html'
def get_context_data(self, **kwargs):
context = super(CurrentShowView, self).get_context_data(**kwargs)
diff --git a/templates/program/current.html b/templates/program/current.html
deleted file mode 100644
index 193762a..0000000
--- a/templates/program/current.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<html>
-<head>
- <title>Current program</title>
-</head>
-<body>
-
-<div id="program-now">
- <div id="current-show">
- {{ current }}
- </div>
-
- <div id="next-show">
- {{ next }}
- </div>
-
- <div id="after-next-show">
- {{ after_next }}
- </div>
-</div>
-
-</body>
-</html> \ No newline at end of file
diff --git a/templates/program/current_box.html b/templates/program/current_box.html
new file mode 100644
index 0000000..3977994
--- /dev/null
+++ b/templates/program/current_box.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+ <title>Current program box</title>
+ <link href="/site_media/styles/base.css" media="screen" rel="stylesheet" type="text/css" />
+</head>
+<body>
+
+<div id="current">
+ <div id="current-title">Programm derzeit</div>
+
+ <div id="current-timeslot">
+ <div class="start">{{ current.start|date:"H:i" }}</div>
+ <div class="show {{ current.show.broadcastformat.slug }}">
+ <div class="name"><a href="{% url timeslot-detail current.id %}">{{ current.show.name }}</a></div>
+ {% if current.note %}
+ <div class="note-title">{{ current.note.title }}</div>
+ {% else %}
+ <div class="short-description">{{ current.show.short_description }}</div>
+ {% endif %}
+ </div>
+ </div>
+
+ <div id="next-timeslot">
+ <div class="start">{{ next.start|date:"H:i" }}</div>
+ <div class="show {{ next.show.broadcastformat.slug }}">
+ <div class="name"><a href="{% url timeslot-detail next.id %}">{{ next.show.name }}</a></div>
+ </div>
+ </div>
+
+ <div id="after-next-timeslot">
+ <div class="start"> {{ after_next.start|date:"H:i" }}</div>
+ <div class="show {{ after_next.show.broadcastformat.slug }}">
+ <div class="name"><a href="{% url timeslot-detail after_next.id %}">{{ after_next.show.name }}</div></a>
+ </div>
+ </div>
+</div>
+
+</body>
+</html> \ No newline at end of file