diff options
author | Christian Pointner <equinox@spreadspace.org> | 2012-02-15 21:35:57 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2012-02-15 21:35:57 (GMT) |
commit | 55b2560b6180addea5d8b16e4dd4f80314fd7e09 (patch) | |
tree | 232cf374e4dc8c2e0ffc2bb2dac95ae445cfb010 /program | |
parent | a7e37419316c72ad89253123cc4577f1f4648673 (diff) |
show specials as recommendations even if there is no note attached
Diffstat (limited to 'program')
-rw-r--r-- | program/views.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/program/views.py b/program/views.py index c3d1b03..83a5994 100644 --- a/program/views.py +++ b/program/views.py @@ -1,5 +1,6 @@ from django.views.generic import list_detail, simple from django.shortcuts import get_object_or_404 +from django.db.models import Q from models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic, TimeSlot @@ -29,10 +30,10 @@ def show_list(request): def recommendations(request, template_name='program/recommendations.html'): now = datetime.now() - in_one_week = now + timedelta(weeks=1) - - queryset = Note.objects.filter(status=1, timeslot__start__range=(now, in_one_week))[:20] + end = now + timedelta(weeks=1) + queryset = TimeSlot.objects.filter(Q(note__isnull=False, note__status=1, start__range=(now, end)) | + Q(show__broadcastformat__slug='sondersendung', start__range=(now, end))).order_by('start')[:20] return list_detail.object_list(request, queryset=queryset, template_name=template_name, template_object_name='recommendation') def day_schedule(request, year=None, month=None, day=None): |