summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 %}