diff options
author | Ernesto Rico-Schmidt <ernesto.rico-schmidt@evolaris.net> | 2016-08-20 19:25:26 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <ernesto.rico-schmidt@evolaris.net> | 2016-08-20 19:29:55 (GMT) |
commit | 4d830b21886e27e0a1b409cf5b40c78cd96c3d73 (patch) | |
tree | 2eb63363eb9508cf7615fd126086a9ace1ac5f48 /program | |
parent | 4261cdac6e396294fe5f1b4fc3fcfdfaac6526c4 (diff) |
list only active host and active shows.
Diffstat (limited to 'program')
-rw-r--r-- | program/views.py | 6 |
1 files changed, 2 insertions, 4 deletions
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) |