Skip to content
Snippets Groups Projects
Commit 6463c08c authored by Christian Pointner's avatar Christian Pointner
Browse files

only show active program_slots at show_detail

parent 55b2560b
No related branches found
No related tags found
No related merge requests found
...@@ -239,6 +239,12 @@ class ProgramSlot(models.Model): ...@@ -239,6 +239,12 @@ class ProgramSlot(models.Model):
return self.timeslots.count() return self.timeslots.count()
timeslot_count.description = _("Time slot 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): class TimeSlotManager(models.Manager):
def get_or_create_current(self): def get_or_create_current(self):
try: try:
......
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
{% if show.id != 1 %} {% if show.id != 1 %}
<p id="programslots"> <p id="programslots">
{% for slot in show.programslots.all %} {% 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 %} {% endfor %}
</p> </p>
{% endif %} {% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment