diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2014-05-01 21:43:18 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2014-05-01 21:43:18 (GMT) |
commit | bfcdf06fc0321f230fde9c542f793bd35dc6139b (patch) | |
tree | dae34c525ec17d70f4b759edbeb2521b41537b35 | |
parent | f2c4d866489a4aef845d7c422b98febf402472dc (diff) |
added always_visible to the Hosts and updated template and URLs
-rw-r--r-- | program/models.py | 1 | ||||
-rw-r--r-- | program/templates/host_detail.html | 4 | ||||
-rw-r--r-- | program/urls.py | 4 |
3 files changed, 8 insertions, 1 deletions
diff --git a/program/models.py b/program/models.py index 50b5889..1541754 100644 --- a/program/models.py +++ b/program/models.py @@ -219,6 +219,7 @@ class MusicFocus(models.Model): class Host(models.Model): name = models.CharField(_("Name"), max_length=128) + always_visible = models.BooleanField(_("Always visible"), default=False) email = models.EmailField(_("E-Mail"), blank=True) website = models.URLField(_("Website"), blank=True) diff --git a/program/templates/host_detail.html b/program/templates/host_detail.html index bbe801e..3d8e862 100644 --- a/program/templates/host_detail.html +++ b/program/templates/host_detail.html @@ -11,7 +11,11 @@ <div id="shows-title">Sendungen</div> {% for show in host.shows.all %} + {% if show.has_active_programslots %} <div class="show {{ show.broadcastformat.slug }}"><a href="{% url show-detail show.slug %}">{{ show }}</a></div> + {% else %} + <div class="show {{ show.broadcastformat.slug }}">{{ show }}</div> + {% endif %} {% endfor %} </div> diff --git a/program/urls.py b/program/urls.py index fbdc037..d5af119 100644 --- a/program/urls.py +++ b/program/urls.py @@ -1,5 +1,6 @@ from django.conf import settings from django.conf.urls.defaults import * +from django.db.models import Q from django.views.decorators.cache import cache_page from django.views.generic.list_detail import object_detail, object_list @@ -11,7 +12,8 @@ from datetime import date hosts_dict = { 'queryset': Host.objects.filter( - shows__programslots__until__gte=date.today()).distinct(), + Q(shows__programslots__until__gte=date.today()) | + Q(always_visible=True)).distinct(), 'template_object_name': 'host' } shows_dict = { |