summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-02-15 22:06:22 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2012-02-15 22:06:22 (GMT)
commit6463c08c83fea3c744ca5bfdd31699bffd118e4f (patch)
tree1d06a213a32452ddf35388331f794625b15b596d
parent55b2560b6180addea5d8b16e4dd4f80314fd7e09 (diff)
only show active program_slots at show_detail
-rw-r--r--program/models.py6
-rw-r--r--templates/program/show_detail.html4
2 files changed, 9 insertions, 1 deletions
diff --git a/program/models.py b/program/models.py
index 0b78347..9197837 100644
--- a/program/models.py
+++ b/program/models.py
@@ -239,6 +239,12 @@ class ProgramSlot(models.Model):
return self.timeslots.count()
timeslot_count.description = _("Time slot count")
+ def has_active_timeslot(self):
+ start = self.timeslots.all().order_by("start")[0].start
+ end = self.timeslots.all().order_by("-end")[0].end
+ now = datetime.now()
+ return (start < now and end > now)
+
class TimeSlotManager(models.Manager):
def get_or_create_current(self):
try:
diff --git a/templates/program/show_detail.html b/templates/program/show_detail.html
index b5c5f91..8337155 100644
--- a/templates/program/show_detail.html
+++ b/templates/program/show_detail.html
@@ -14,7 +14,9 @@
{% if show.id != 1 %}
<p id="programslots">
{% for slot in show.programslots.all %}
- <span class="programslot">{{ slot }}</span><br />
+ {% if slot.has_active_timeslot %}
+ <span class="programslot">{{ slot }}</span><br />
+ {% endif %}
{% endfor %}
</p>
{% endif %}