diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-05-01 19:32:32 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-05-01 19:32:32 (GMT) |
commit | 3dde0e9f3d6df71d962a8a409b11afe12762309b (patch) | |
tree | 7a30f1932ecefe696af36f58e3347c2023b40b8b | |
parent | f08a6076ed4a0fdfdc0281ff4a8cac5bbd157c8c (diff) |
fill empty timeslots in day and week schedule views with a default show.
-rw-r--r-- | program/views.py | 8 | ||||
-rw-r--r-- | templates/program/day_schedule.html | 40 | ||||
-rw-r--r-- | templates/program/week_schedule.html | 72 |
3 files changed, 117 insertions, 3 deletions
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 @@ <div id="timeslots"> {% for timeslot in timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + <div class="show-start">{{ timeslot.get_previous_by_start.end|date:"H:i" }}</div> + <div class="show-abbrevs"> + {% for item in default_show.showinformation.all %} + <span title="{{item.information}}" class="abbrev si-{{ item.abbrev }}"><span>{{ item.abbrev }}</span></span> + {% endfor %} + {% for item in default_show.showtopic.all %} + <span title="{{item.topic}}" class="abbrev st-{{ item.abbrev }}"><span>{{ item.abbrev }}</span></span> + {% endfor %} + {% for item in default_show.musicfocus.all %} + <span title="{{item.focus}}" class="abbrev mf-{{ item.abbrev }}"><span>{{ item.abbrev }}</span></span> + {% endfor %} + </div> + <div class="show-detail"> + <h3 class="show-title">{{ default_show.name }}</h3> + <p class="show-description">{{ default_show.short_description }}</p> + </div> + </div> + {% endif %} <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}"> <div class="show-start">{{ timeslot.start|date:"H:i" }}</div> <div class="show-abbrevs"> @@ -53,6 +73,26 @@ {% endif %} </div> </div> + {% if timeslot.end != timeslot.get_next_by_start.start %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + <div class="show-start">{{ timeslot.end|date:"H:i" }}</div> + <div class="show-abbrevs"> + {% for item in default_show.showinformation.all %} + <span title="{{item.information}}" class="abbrev si-{{ item.abbrev }}"><span>{{ item.abbrev }}</span></span> + {% endfor %} + {% for item in default_show.showtopic.all %} + <span title="{{item.topic}}" class="abbrev st-{{ item.abbrev }}"><span>{{ item.abbrev }}</span></span> + {% endfor %} + {% for item in default_show.musicfocus.all %} + <span title="{{item.focus}}" class="abbrev mf-{{ item.abbrev }}"><span>{{ item.abbrev }}</span></span> + {% endfor %} + </div> + <div class="show-detail"> + <h3 class="show-title">{{ default_show.name }}</h3> + <p class="show-description">{{ default_show.short_description }}</p> + </div> + </div> + {% endif %} {% endfor %} </div> </div> 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 @@ <div id="monday" class="weekday"> <h2>{{ monday|date:"l d.m.Y" }}</h2> {% for timeslot in monday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}"> - <a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a> + <a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a> </div> + {% if timeslot.end != timeslot.get_next_by_start.start %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} {% endfor %} </div> <div id="tuesday" class="weekday"> <h2>{{ tuesday|date:"l d.m.Y" }}</h2> {% for timeslot in tuesday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}"> <a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a> </div> + {% if timeslot.end != timeslot.get_next_by_start.start %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} {% endfor %} </div> <div id="wednesday" class="weekday"> <h2>{{ wednesday|date:"l d.m.Y" }}</h2> {% for timeslot in wednesday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}"> <a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a> </div> + {% if timeslot.end != timeslot.get_next_by_start.start %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} {% endfor %} </div> <div id="thursday" class="weekday"> <h2>{{ thursday|date:"l d.m.Y" }}</h2> {% for timeslot in thursday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}"> <a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a> </div> + {% if timeslot.end != timeslot.get_next_by_start.start %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} {% endfor %} </div> <div id="friday" class="weekday"> <h2>{{ friday|date:"l d.m.Y" }}</h2> {% for timeslot in friday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}"> <a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a> </div> + {% if timeslot.end != timeslot.get_next_by_start.start %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} {% endfor %} </div> <div id="saturday" class="weekday"> <h2>{{ saturday|date:"l d.m.Y" }}</h2> {% for timeslot in saturday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}"> <a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a> </div> + {% if timeslot.end != timeslot.get_next_by_start.start %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} {% endfor %} </div> <div id="sunday" class="weekday"> <h2>{{ sunday|date:"l d.m.Y" }}</h2> {% for timeslot in sunday_timeslots %} + {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}"> <a href="{% url timeslot-detail timeslot.id %}">{{ timeslot.show.name }}</a> </div> + {% if timeslot.end != timeslot.get_next_by_start.start %} + <div class="timeslot bf-{{ default_show.broadcastformat.slug }}"> + {{ default_show.name }} + </div> + {% endif %} {% endfor %} </div> </div> |