From 4d830b21886e27e0a1b409cf5b40c78cd96c3d73 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sat, 20 Aug 2016 21:25:26 +0200 Subject: list only active host and active shows. diff --git a/program/views.py b/program/views.py index 94164b6..7f9b1ce 100644 --- a/program/views.py +++ b/program/views.py @@ -15,24 +15,22 @@ from program.utils import tofirstdayinisoweek class HostListView(ListView): context_object_name = 'host_list' - queryset = Host.objects.filter(is_always_visible=True).distinct() + queryset = Host.objects.filter(Q(is_always_visible=True) | Q(shows__programslots__until__gt=datetime.now())).distinct() template_name = 'host_list.html' class HostDetailView(DetailView): context_object_name = 'host' - queryset = Host.objects.filter(is_always_visible=True).distinct() + queryset = Host.objects.all() template_name = 'host_detail.html' class ShowListView(ListView): context_object_name = 'show_list' - queryset = Show.objects.exclude(id=1).distinct() template_name = 'show_list.html' def get_queryset(self): queryset = Show.objects.filter(programslots__until__gt=date.today()).exclude(id=1).distinct() - if 'broadcastformat' in self.request.GET: broadcastformat = get_object_or_404(BroadcastFormat, slug=self.request.GET['broadcastformat']) queryset = queryset.filter(broadcastformat=broadcastformat) -- cgit v0.10.2