From 3dde0e9f3d6df71d962a8a409b11afe12762309b Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 1 May 2011 21:32:32 +0200 Subject: fill empty timeslots in day and week schedule views with a default show. diff --git a/program/views.py b/program/views.py index d3e72f5..52f7355 100644 --- a/program/views.py +++ b/program/views.py @@ -45,7 +45,9 @@ def day_schedule(request, year=None, month=None, day=None): recommendations = Note.objects.filter(status=1, timeslot__start__range=(today, tomorrow)) - extra_context = dict(day=today, recommendations=recommendations) + default_show = Show.objects.get(pk=1) + + extra_context = dict(day=today, recommendations=recommendations, default_show=default_show) timeslots = TimeSlot.objects.get_day_timeslots(today) @@ -80,7 +82,9 @@ def week_schedule(request, year=None, week=None): saturday = monday+timedelta(days=5) sunday = monday+timedelta(days=6) - extra_context = dict(monday=monday, tuesday=tuesday, wednesday=wednesday, thursday=thursday, friday=friday, saturday=saturday, sunday=sunday) + default_show = Show.objects.get(pk=1) + + extra_context = dict(monday=monday, tuesday=tuesday, wednesday=wednesday, thursday=thursday, friday=friday, saturday=saturday, sunday=sunday, default_show=default_show) extra_context['monday_timeslots'] = TimeSlot.objects.get_day_timeslots(monday) extra_context['tuesday_timeslots'] = TimeSlot.objects.get_day_timeslots(tuesday) diff --git a/templates/program/day_schedule.html b/templates/program/day_schedule.html index cf71bd7..a336fdb 100644 --- a/templates/program/day_schedule.html +++ b/templates/program/day_schedule.html @@ -29,6 +29,26 @@
{% for timeslot in timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} +
+
{{ timeslot.get_previous_by_start.end|date:"H:i" }}
+
+ {% for item in default_show.showinformation.all %} + {{ item.abbrev }} + {% endfor %} + {% for item in default_show.showtopic.all %} + {{ item.abbrev }} + {% endfor %} + {% for item in default_show.musicfocus.all %} + {{ item.abbrev }} + {% endfor %} +
+
+

{{ default_show.name }}

+

{{ default_show.short_description }}

+
+
+ {% endif %}
{{ timeslot.start|date:"H:i" }}
@@ -53,6 +73,26 @@ {% endif %}
+ {% if timeslot.end != timeslot.get_next_by_start.start %} +
+
{{ timeslot.end|date:"H:i" }}
+
+ {% for item in default_show.showinformation.all %} + {{ item.abbrev }} + {% endfor %} + {% for item in default_show.showtopic.all %} + {{ item.abbrev }} + {% endfor %} + {% for item in default_show.musicfocus.all %} + {{ item.abbrev }} + {% endfor %} +
+
+

{{ default_show.name }}

+

{{ default_show.short_description }}

+
+
+ {% endif %} {% endfor %}
diff --git a/templates/program/week_schedule.html b/templates/program/week_schedule.html index df7b177..2d01ebd 100644 --- a/templates/program/week_schedule.html +++ b/templates/program/week_schedule.html @@ -11,63 +11,133 @@

{{ monday|date:"l d.m.Y" }}

{% for timeslot in monday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} +
+ {{ default_show.name }} +
+ {% endif %} + {% if timeslot.end != timeslot.get_next_by_start.start %} +
+ {{ default_show.name }} +
+ {% endif %} {% endfor %}

{{ tuesday|date:"l d.m.Y" }}

{% for timeslot in tuesday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} +
+ {{ default_show.name }} +
+ {% endif %} + {% if timeslot.end != timeslot.get_next_by_start.start %} +
+ {{ default_show.name }} +
+ {% endif %} {% endfor %}

{{ wednesday|date:"l d.m.Y" }}

{% for timeslot in wednesday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} +
+ {{ default_show.name }} +
+ {% endif %} + {% if timeslot.end != timeslot.get_next_by_start.start %} +
+ {{ default_show.name }} +
+ {% endif %} {% endfor %}

{{ thursday|date:"l d.m.Y" }}

{% for timeslot in thursday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} +
+ {{ default_show.name }} +
+ {% endif %} + {% if timeslot.end != timeslot.get_next_by_start.start %} +
+ {{ default_show.name }} +
+ {% endif %} {% endfor %}

{{ friday|date:"l d.m.Y" }}

{% for timeslot in friday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} +
+ {{ default_show.name }} +
+ {% endif %} + {% if timeslot.end != timeslot.get_next_by_start.start %} +
+ {{ default_show.name }} +
+ {% endif %} {% endfor %}

{{ saturday|date:"l d.m.Y" }}

{% for timeslot in saturday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} +
+ {{ default_show.name }} +
+ {% endif %} + {% if timeslot.end != timeslot.get_next_by_start.start %} +
+ {{ default_show.name }} +
+ {% endif %} {% endfor %}

{{ sunday|date:"l d.m.Y" }}

{% for timeslot in sunday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} +
+ {{ default_show.name }} +
+ {% endif %} + {% if timeslot.end != timeslot.get_next_by_start.start %} +
+ {{ default_show.name }} +
+ {% endif %} {% endfor %}
-- cgit v0.10.2