diff options
-rw-r--r-- | README.rst | 1 | ||||
-rw-r--r-- | helsinki/program/models.py | 2 | ||||
-rw-r--r-- | helsinki/program/search_indexes.py | 23 | ||||
-rw-r--r-- | helsinki/program/search_sites.py | 2 | ||||
-rw-r--r-- | helsinki/program/settings.py | 36 | ||||
-rw-r--r-- | helsinki/program/site_media/styles/base.css | 152 | ||||
-rw-r--r-- | helsinki/program/templates/program/current_box.html | 2 | ||||
-rw-r--r-- | helsinki/program/templates/program/host_list.html | 2 | ||||
-rw-r--r-- | helsinki/program/templates/program/recommendations.html | 7 | ||||
-rw-r--r-- | helsinki/program/templates/search/indexes/program/note_text.txt | 2 | ||||
-rw-r--r-- | helsinki/program/templates/search/indexes/program/show_text.txt | 3 | ||||
-rw-r--r-- | helsinki/program/urls_program.py | 33 | ||||
-rw-r--r-- | helsinki/program/views.py | 199 |
13 files changed, 291 insertions, 173 deletions
@@ -14,5 +14,6 @@ Requirements Author ------ + Ernesto Rico-Schmidt Contributions: Johannes Raggam diff --git a/helsinki/program/models.py b/helsinki/program/models.py index d792efb..5f0f835 100644 --- a/helsinki/program/models.py +++ b/helsinki/program/models.py @@ -221,7 +221,7 @@ class ProgramSlot(models.Model): class TimeSlotManager(models.Manager): def get_or_create_current(self): try: - return TimeSlot.objects.get(start__lte=datetime.now(), end__gte=datetime.now()) + return TimeSlot.objects.get(start__lte=datetime.now(), end__gt=datetime.now()) except ObjectDoesNotExist: once = RRule.objects.get(pk=1) today = date.today().weekday() diff --git a/helsinki/program/search_indexes.py b/helsinki/program/search_indexes.py new file mode 100644 index 0000000..8c21e14 --- /dev/null +++ b/helsinki/program/search_indexes.py @@ -0,0 +1,23 @@ +from haystack.indexes import CharField, DateTimeField, SearchIndex +from haystack import site + +from datetime import datetime + +from program.models import Note, Show + +class NoteIndex(SearchIndex): + text = CharField(document=True, use_template=True) + last_updated = DateTimeField(model_attr='last_updated') + + def get_queryset(self): + return Note.objects.filter(last_updated__lte=datetime.now()) + +class ShowIndex(SearchIndex): + text = CharField(document=True, use_template=True) + last_updated = DateTimeField(model_attr='last_updated') + + def get_queryset(self): + return Show.objects.filter(last_updated__lte=datetime.now()) + +site.register(Note, NoteIndex) +site.register(Show, ShowIndex)
\ No newline at end of file diff --git a/helsinki/program/search_sites.py b/helsinki/program/search_sites.py new file mode 100644 index 0000000..fe5127a --- /dev/null +++ b/helsinki/program/search_sites.py @@ -0,0 +1,2 @@ +import haystack +haystack.autodiscover()
\ No newline at end of file diff --git a/helsinki/program/settings.py b/helsinki/program/settings.py index c5173a5..43a3d1d 100644 --- a/helsinki/program/settings.py +++ b/helsinki/program/settings.py @@ -34,19 +34,7 @@ MEDIA_ROOT = '' MEDIA_URL = '' -STATIC_ROOT = '' - -STATIC_URL = '/static/' - -ADMIN_MEDIA_PREFIX = '/static/admin/' - -STATICFILES_DIRS = () - -STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.FileSystemFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', -) +ADMIN_MEDIA_PREFIX = '/media/' SECRET_KEY = 'oepk-$!=)c)7+y%cdz-x46_h5bp!o-*9%dv!(sf=3r4zfqk_(t' @@ -76,25 +64,11 @@ INSTALLED_APPS = ( 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', - 'django.contrib.staticfiles', 'django.contrib.admin', 'helsinki.program', + 'haystack', ) -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'class': 'django.utils.log.AdminEmailHandler' - } - }, - 'loggers': { - 'django.request':{ - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - } -} +HAYSTACK_SITECONF = 'helsinki.search_sites' +HAYSTACK_SEARCH_ENGINE = 'solr' +HAYSTACK_SOLR_URL = 'http://localhost:8983/solr' diff --git a/helsinki/program/site_media/styles/base.css b/helsinki/program/site_media/styles/base.css new file mode 100644 index 0000000..51194b1 --- /dev/null +++ b/helsinki/program/site_media/styles/base.css @@ -0,0 +1,152 @@ +#recommendations-box, +#day-schedule, +#broadcastformats, +#filter, +#shows { + display: inline; + float: left; +} + +#filter { width: 213px; } +#recommendations-box { width: 213px; } +#day-schedule { width: 700px; } +#shows {width: 700px;} +#broadcastformats { width: 170px; } +#current-timeslot, +#next-timeslot, +#after-next-timeslot { + clear: both; +} + +#current-timeslot .start, +#next-timeslot .start, +#after-next-timeslot .start { + display: inline; + float: left; +} + +#current-timeslot .show, +#next-timeslot .show, +#after-next-timeslot .show { + display: inline; + float: left; +} + +/* FIXME: fill the actual colors */ +#current-timeslot .experimentell, +#next-timeslot .experimentell, +#after-next-timeslot .experimentell, +#recommendations-box .experimentell { + border-left: red solid 3px; +} +#current-timeslot .feature-magazin, +#next-timeslot .feature-magazin, +#after-next-timeslot .feature-magazin, +#recommendations-box .feature-magazin { + border-left: red solid 3px; +} +#current-timeslot .horspiel-literatur, +#next-timeslot .horspiel-literatur, +#after-next-timeslot .horspiel-literatur, +#recommendations-box .horspiel-literatur { + border-left: red solid 3px; +} +#current-timeslot .musiksendung, +#next-timeslot .musiksendung, +#after-next-timeslot .musiksendung, +#recommendations-box .musiksendung { + border-left: red solid 3px; +} +#current-timeslot .talk, +#next-timeslot .talk, +#after-next-timeslot .talk, +#recommendations-box .talk { + border-left: red solid 3px; +} +#current-timeslot .unmoderiertes-musikprogramm, +#next-timeslot .unmoderiertes-musikprogramm, +#after-next-timeslot .unmoderiertes-musikprogramm, +#recommendations-box .unmoderiertes-musikprogramm { + border-left: red solid 3px; +} +#current-timeslot .vortrag-diskussion, +#next-timeslot .vortrag-diskussion, +#after-next-timeslot .vortrag-diskussion, +#recommendations-box .vortrag-diskussion { + border-left: red solid 3px; +} + +#recommendations-box .recommendation { + clear: both; +} + +/* FIXME: fill the actual colors */ +#day-schedule .experimentell { + background-color: red; +} +#day-schedule .feature-magazin { + background-color: red; +} +#day-schedule .horspiel-literatur { + background-color: red; +} +#day-schedule .musiksendung { + background-color: red; +} +#day-schedule .talk { + background-color: red; +} +#day-schedule .unmoderiertes-musikprogramm { + background-color: red; +} +#day-schedule .vortrag-diskussion { + background-color: red; +} + +#day-schedule .timeslot { + clear: both; +} + +.timeslot .start, +.timeslot .show-abbrevs, +.timeslot .show { + display: inline; + float: left; +} + +.timeslot .show-abbrevs { width: 50px; } + +#shows .show { clear: both; } + +.show .abbrevs { + width: 50px; + display: inline; + float: left; +} +.show .details { + display: inline; + float: left; +} + +.details .name, +.details .programslots, +.details .short-description { + display: inline; + float: left; +} + +#week-schedule { width: 960px; } +#week-schedule .weekday { font-size: small; height: 2em; } + +#monday, +#tuesday, +#wednesday, +#thursday, +#friday, +#saturday, +#sunday { + display: inline; + float: left; + font-size: small; + width: 123px; +} diff --git a/helsinki/program/templates/program/current_box.html b/helsinki/program/templates/program/current_box.html index 21713be..a2341d3 100644 --- a/helsinki/program/templates/program/current_box.html +++ b/helsinki/program/templates/program/current_box.html @@ -17,7 +17,7 @@ {% if current.note %} <div class="note-title">{{ current.note.title }}</div> {% else %} - {% if current.show.short_description != 'FIMXE' %} + {% if current.show.short_description != 'FIXME' %} <div class="short-description">{{ current.show.short_description }}</div> {% endif %} {% endif %} diff --git a/helsinki/program/templates/program/host_list.html b/helsinki/program/templates/program/host_list.html index 6497d35..5ab5c3f 100644 --- a/helsinki/program/templates/program/host_list.html +++ b/helsinki/program/templates/program/host_list.html @@ -6,7 +6,7 @@ <body> <div id="host-list"> -{% for host in hosts %} +{% for host in host_list %} <div class="host"> <a href="{% url host-detail host.id %}">{{ host.name }}</a> </div> diff --git a/helsinki/program/templates/program/recommendations.html b/helsinki/program/templates/program/recommendations.html index a8f5fde..c34d5e5 100644 --- a/helsinki/program/templates/program/recommendations.html +++ b/helsinki/program/templates/program/recommendations.html @@ -6,9 +6,10 @@ <body> <div id="recommendations"> -{% for recommendation in recommendations %} - <div class="recommendation"> - <div class="timeslot-start-end">{{ recommendation.timeslot.start|date:"d.m.Y H:i" }} - {{ recommendation.timeslot.end|date:"H:i" }}</div> + <div id="recommendations-title">Programmhinweise</div> +{% for recommendation in recommendation_list %} + <div class="recommendation {{ recommendation.show.broadcastformat.slug }}"> + <div class="timeslot-start-end">{{ recommendation.timeslot.start|date:"d.m. H:i" }}-{{ recommendation.timeslot.end|date:"H:i" }}</div> <div class="show-name"><a href="{% url show-detail recommendation.show.slug %}">{{ recommendation.show.name }}</a></div> {% if recommendation.show.short_description != 'FIXME' %} <div class="show-short-description">{{ recommendation.show.short_description }}</div> diff --git a/helsinki/program/templates/search/indexes/program/note_text.txt b/helsinki/program/templates/search/indexes/program/note_text.txt new file mode 100644 index 0000000..2421b4f --- /dev/null +++ b/helsinki/program/templates/search/indexes/program/note_text.txt @@ -0,0 +1,2 @@ +{{ object.title }} +{{ object.content }}
\ No newline at end of file diff --git a/helsinki/program/templates/search/indexes/program/show_text.txt b/helsinki/program/templates/search/indexes/program/show_text.txt new file mode 100644 index 0000000..f08b515 --- /dev/null +++ b/helsinki/program/templates/search/indexes/program/show_text.txt @@ -0,0 +1,3 @@ +{{ object.name }} +{{ object.description }} +{{ object.short_description }}
\ No newline at end of file diff --git a/helsinki/program/urls_program.py b/helsinki/program/urls_program.py index 14fd7a3..e2d8ae8 100644 --- a/helsinki/program/urls_program.py +++ b/helsinki/program/urls_program.py @@ -1,23 +1,20 @@ from django.conf.urls.defaults import * -from django.views.generic.detail import DetailView -from django.views.generic.list import ListView -from helsinki.program.models import Host, Show, TimeSlot -from helsinki.program.views import CurrentShowView, DayScheduleView, RecommendationsView, ShowListView, TodayScheduleView, WeekScheduleView +from django.views.generic.list_detail import object_detail, object_list + +from models import Host, Show, TimeSlot +from views import current_show, day_schedule, recommendations, show_list, today_schedule, week_schedule urlpatterns = patterns('', - ('^/today/?$', TodayScheduleView.as_view()), - ('^/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/?$', DayScheduleView.as_view()), - ('^/(?P<year>\d{4})/(?P<week>\d{1,2})/?$', WeekScheduleView.as_view()), - ('^/current_box/?$', CurrentShowView.as_view()), - ('^/hosts/?$', ListView.as_view(model=Host, context_object_name='hosts')), - url('^/hosts/(?P<pk>\d+)/?$', DetailView.as_view(model=Host), name='host-detail'), - ('^/tips/?$', RecommendationsView.as_view()), - ('^/tips_box/?$', RecommendationsView.as_view(template_name='program/recommendations_box.html')), - ('^/shows/?$', ShowListView.as_view()), - url('^/shows/(?P<slug>[\w-]+)/?$', DetailView.as_view(model=Show), name='show-detail'), - url('^/(?P<pk>\d+)/?$', DetailView.as_view(model=TimeSlot), name='timeslot-detail'), - # TODO: implement - ('^/week/?$', TodayScheduleView.as_view()), - ('^/topics/?$', RecommendationsView.as_view(template_name='program/recommendations_box.html')), + ('^/today/$', today_schedule), + ('^/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', day_schedule), + ('^/(?P<year>\d{4})/(?P<week>\d{1,2})/$', week_schedule), + ('^/current_box/$', current_show), + ('^/hosts/$', object_list, dict(template_object_name='host', queryset=Host.objects.all())), + url('^/hosts/(?P<object_id>\d+)/$', object_detail, dict(template_object_name='host', queryset=Host.objects.all()), name='host-detail'), + ('^/tips/$', recommendations), + ('^/tips_box/$', recommendations, dict(template_name='program/recommendations_box.html')), + ('^/shows/$', show_list), + url('^/shows/(?P<slug>[\w-]+)/$', object_detail, dict(template_object_name='show', queryset=Show.objects.all()), name='show-detail'), + url('^/(?P<object_id>\d+)/$', object_detail, dict(template_object_name='timeslot', queryset=TimeSlot.objects.all()), name='timeslot-detail'), ) diff --git a/helsinki/program/views.py b/helsinki/program/views.py index b118161..2e9cd8a 100644 --- a/helsinki/program/views.py +++ b/helsinki/program/views.py @@ -1,150 +1,113 @@ -from django.views.generic.list import ListView -from django.views.generic.base import TemplateView +from django.views.generic import list_detail +from django.views.generic import simple from django.shortcuts import get_object_or_404 from helsinki.program.models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic, TimeSlot from datetime import date, datetime, time, timedelta -class ShowListView(ListView): - context_object_name = 'shows' +def show_list(request): + broadcastformats = BroadcastFormat.objects.all() + musicfoci = MusicFocus.objects.all() + showinformation = ShowInformation.objects.all() + showtopics = ShowTopic.objects.all() - def get_context_data(self, **kwargs): - context = super(ShowListView, self).get_context_data(**kwargs) + extra_context = dict(broadcastformats=broadcastformats, musicfoci=musicfoci, showinformation=showinformation, showtopics=showtopics) + + if 'broadcastformat' in request.GET: + broadcastformat = get_object_or_404(BroadcastFormat, slug=request.GET['broadcastformat']) - context['broadcastformats'] = BroadcastFormat.objects.all() - context['musicfoci'] = MusicFocus.objects.all() - context['showinformations'] = ShowInformation.objects.all() - context['showtopics'] = ShowTopic.objects.all() + queryset = Show.objects.filter(broadcastformat=broadcastformat) + elif 'musicfocus' in request.GET: + musicfocus = get_object_or_404(MusicFocus, slug=request.GET['musicfocus']) - return context + queryset = Show.objects.filter(musicfocus=musicfocus) + elif 'showinformation' in request.GET: + showinformation = get_object_or_404(ShowInformation, slug=request.GET['showinformation']) - def get_queryset(self): - if 'broadcastformat' in self.request.GET: - broadcastformat = get_object_or_404(BroadcastFormat, slug=self.request.GET['broadcastformat']) + queryset = Show.objects.filter(showinformation=showinformation) + elif 'showtopic' in request.GET: + showtopic = get_object_or_404(ShowTopic, slug=request.GET['showtopic']) - return Show.objects.filter(broadcastformat=broadcastformat) - elif 'musicfocus' in self.request.GET: - musicfocus = get_object_or_404(MusicFocus, slug=self.request.GET['musicfocus']) + queryset = Show.objects.filter(showtopic=showtopic) + else: + queryset = Show.objects.all() - return Show.objects.filter(musicfocus=musicfocus) - elif 'showinformation' in self.request.GET: - showinformation = get_object_or_404(ShowInformation, slug=self.request.GET['showinformation']) - return Show.objects.filter(showinformation=showinformation) - elif 'showtopic' in self.request.GET: - showtopic = get_object_or_404(ShowTopic, slug=self.request.GET['showtopic']) + return list_detail.object_list(request, queryset=queryset, extra_context=extra_context, template_object_name='show') - return Show.objects.filter(showtopic=showtopic) - else: - return Show.objects.all() +def recommendations(request, template_name='program/recommendations.html'): + now = datetime.now() + in_one_week = now + timedelta(weeks=1) -class RecommendationsView(ListView): - context_object_name = 'recommendations' - template_name = 'program/recommendations.html' + queryset = Note.objects.filter(status=1, timeslot__start__range=(now, in_one_week))[:10] - def get_queryset(self): - now = datetime.now() - in_one_week = now + timedelta(weeks=1) + return list_detail.object_list(request, queryset=queryset, template_name=template_name, template_object_name='recommendation') - return Note.objects.filter(status=1, timeslot__start__range=(now, in_one_week))[:10] +def today_schedule(request): + now = datetime.now() + today = datetime.combine(date.today(), time(6, 0)) + tomorrow = today + timedelta(days=1) -class TodayScheduleView(TemplateView): - template_name = 'program/day_schedule.html' + broadcastformats = BroadcastFormat.objects.all() + recommendations = Note.objects.filter(status=1, timeslot__start__range=(now, tomorrow)) - def get_context_data(self, **kwargs): - context = super(TodayScheduleView, self).get_context_data(**kwargs) + extra_context = dict(day=today, broadcastformats=broadcastformats, recommendations=recommendations) - now = datetime.now() - today = datetime.combine(date.today(), time(6, 0)) - tomorrow = datetime.combine(date.today()+timedelta(days=1), time(6, 0)) + if 'broadcastformat' in request.GET: + broadcastformat = get_object_or_404(BroadcastFormat, slug=request.GET['broadcastformat']) - context['day'] = today - context['broadcastformats'] = BroadcastFormat.objects.all() - context['recommendations'] = Note.objects.filter(status=1, timeslot__start__range=(now, tomorrow)) + extra_context['timeslots'] = TimeSlot.objects.filter(start__range=(today, tomorrow), show__broadcastformat=broadcastformat) + else: + extra_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']) + return simple.direct_to_template(request, extra_context=extra_context, template='program/day_schedule.html') - context['timeslots'] = TimeSlot.objects.filter(start__range=(today, tomorrow), show__broadcastformat=broadcastformat) - else: - context['timeslots'] = TimeSlot.objects.filter(start__range=(today, tomorrow)) +def day_schedule(request, year, month, day): + this_day = datetime.strptime('%s__%s__%s__06__00' % (year, month, day), '%Y__%m__%d__%H__%M') + that_day = this_day+timedelta(days=1) - return context + broadcastformats = BroadcastFormat.objects.all() + recommendations = Note.objects.filter(status=1, timeslot__start__range=(this_day, that_day)) -class DayScheduleView(TemplateView): - template_name = 'program/day_schedule.html' + extra_context = dict(day=this_day, broadcastformats=broadcastformats, recommendations=recommendations) - def get_context_data(self, **kwargs): - context = super(DayScheduleView, self).get_context_data(**kwargs) + if 'broadcastformat' in request.GET: + broadcastformat = get_object_or_404(BroadcastFormat, slug=request.GET['broadcastformat']) - year = context['params']['year'] - month = context['params']['month'] - day = context['params']['day'] + extra_context['timeslots'] = TimeSlot.objects.filter(start__range=(this_day, that_day), show__broadcastformat=broadcastformat) + else: + extra_context['timeslots'] = TimeSlot.objects.filter(start__range=(this_day, that_day)) - # start the day at 6 - this_day = datetime.strptime('%s__%s__%s__06__00' % (year, month, day), '%Y__%m__%d__%H__%M') - that_day = this_day+timedelta(days=1) + return simple.direct_to_template(request, extra_context=extra_context, template='program/day_schedule.html') - context['day'] = this_day - context['broadcastformats'] = BroadcastFormat.objects.all() - context['recommendations'] = Note.objects.filter(status=1, timeslot__start__range=(this_day, that_day)) +def current_show(request): + current = TimeSlot.objects.get_or_create_current() + next = current.get_next_by_start() + after_next = next.get_next_by_start() - if 'broadcastformat' in self.request.GET: - broadcastformat = get_object_or_404(BroadcastFormat, slug=self.request.GET['broadcastformat']) + extra_context = dict(current=current, next=next, after_next=after_next) - 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 simple.direct_to_template(request, template='program/current_box.html', extra_context=extra_context) - return context - -class CurrentShowView(TemplateView): - template_name = 'program/current_box.html' - - def get_context_data(self, **kwargs): - context = super(CurrentShowView, self).get_context_data(**kwargs) - - context['current'] = TimeSlot.objects.get_or_create_current() - context['next'] = TimeSlot.objects.get_or_create_current().get_next_by_start() - context['after_next'] = TimeSlot.objects.get_or_create_current().get_next_by_start().get_next_by_start() - - return context - -class WeekScheduleView(TemplateView): - template_name = 'program/week_schedule.html' - - def get_context_data(self, **kwargs): - context = super(WeekScheduleView, self).get_context_data(**kwargs) - - year = context['params']['year'] - week = context['params']['week'] - - # start the day at 6 - monday = datetime.strptime('%s__%s__1__06__00' % (year, week), '%Y__%W__%w__%H__%M') - - tuesday = monday+timedelta(days=1) - wednesday = monday+timedelta(days=2) - thursday = monday+timedelta(days=3) - friday = monday+timedelta(days=4) - saturday = monday+timedelta(days=5) - sunday = monday+timedelta(days=6) - next_monday = monday+timedelta(days=7) - - context['monday'] = monday - context['tuesday'] = tuesday - context['wednesday'] = wednesday - context['thursday'] = thursday - context['friday'] = friday - context['saturday'] = saturday - context['sunday'] = sunday - - context['monday_timeslots'] = TimeSlot.objects.filter(start__range=(monday, tuesday)) - context['tuesday_timeslots'] = TimeSlot.objects.filter(start__range=(tuesday, wednesday)) - context['wednesday_timeslots'] = TimeSlot.objects.filter(start__range=(wednesday, thursday)) - context['thursday_timeslots'] = TimeSlot.objects.filter(start__range=(thursday, friday)) - context['friday_timeslots'] = TimeSlot.objects.filter(start__range=(friday, saturday)) - context['saturday_timeslots'] = TimeSlot.objects.filter(start__range=(saturday, sunday)) - context['sunday_timeslots'] = TimeSlot.objects.filter(start__range=(sunday, next_monday)) - - return context +def week_schedule(request, year, week): + monday = datetime.strptime('%s__%s__1__06__00' % (year, week), '%Y__%W__%w__%H__%M') + tuesday = monday+timedelta(days=1) + wednesday = monday+timedelta(days=2) + thursday = monday+timedelta(days=3) + friday = monday+timedelta(days=4) + saturday = monday+timedelta(days=5) + sunday = monday+timedelta(days=6) + next_monday = monday+timedelta(days=7) + + extra_context = dict(monday=monday, tuesday=tuesday, wednesday=wednesday, thursday=thursday, friday=friday, saturday=saturday, sunday=sunday) + + extra_context['monday_timeslots'] = TimeSlot.objects.filter(start__range=(monday, tuesday)) + extra_context['tuesday_timeslots'] = TimeSlot.objects.filter(start__range=(tuesday, wednesday)) + extra_context['wednesday_timeslots'] = TimeSlot.objects.filter(start__range=(wednesday, thursday)) + extra_context['thursday_timeslots'] = TimeSlot.objects.filter(start__range=(thursday, friday)) + extra_context['friday_timeslots'] = TimeSlot.objects.filter(start__range=(friday, saturday)) + extra_context['saturday_timeslots'] = TimeSlot.objects.filter(start__range=(saturday, sunday)) + extra_context['sunday_timeslots'] = TimeSlot.objects.filter(start__range=(sunday, next_monday)) + + return simple.direct_to_template(request, template='program/week_schedule.html', extra_context=extra_context) |