diff options
author | Christian Pointner <equinox@helsinki.at> | 2021-02-24 22:26:27 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2021-02-24 22:26:27 (GMT) |
commit | a1064414914efd53ef1c44ee12392fef8a0c0b0f (patch) | |
tree | 60588ab162cdd607f5236d73750e4d3d6217d793 /program/views.py | |
parent | 1b2eb2aea52e754ad167c63259eec80e35497dfa (diff) | |
parent | f7f4a5d5378b37c32b64bf0f71d0a438fd5d19d8 (diff) |
Merge branch 'add-languages' into stable
Diffstat (limited to 'program/views.py')
-rw-r--r-- | program/views.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/program/views.py b/program/views.py index 365a4db..256ad5d 100644 --- a/program/views.py +++ b/program/views.py @@ -8,7 +8,7 @@ from django.views.generic.base import TemplateView from django.views.generic.detail import DetailView from django.views.generic.list import ListView -from models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic, TimeSlot, Host +from models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic, Language, TimeSlot, Host from program.utils import tofirstdayinisoweek, get_cached_shows @@ -43,6 +43,9 @@ class ShowListView(ListView): elif 'showtopic' in self.request.GET: showtopic = get_object_or_404(ShowTopic, slug=self.request.GET['showtopic']) queryset = queryset.filter(showtopic=showtopic) + elif 'language' in self.request.GET: + language = get_object_or_404(Language, slug=self.request.GET['language']) + queryset = queryset.filter(language=language) return queryset @@ -108,6 +111,9 @@ class DayScheduleView(TemplateView): elif 'showtopic' in self.request.GET: showtopic = get_object_or_404(ShowTopic, slug=self.request.GET['showtopic']) context['showtopic'] = timeslots.filter(show__showtopic=showtopic) + elif 'language' in self.request.GET: + language = get_object_or_404(Language, slug=self.request.GET['language']) + context['showtopic'] = timeslots.filter(show__language=language) else: context['timeslots'] = timeslots return context @@ -214,6 +220,7 @@ def json_day_schedule(request, year=None, month=None, day=None): return HttpResponse(json.dumps(schedule, ensure_ascii=False, encoding='utf8').encode('utf8'), content_type="application/json; charset=utf-8") + def json_timeslots_specials(request): specials = {} shows = get_cached_shows()['shows'] |