remove Schedule.end property + fix templates + add accessibility info

This commit is contained in:
bkfox 2018-02-12 00:34:08 +01:00
parent 9ce2fd228b
commit 9b284c34b3
2 changed files with 13 additions and 10 deletions

View File

@ -578,10 +578,6 @@ class Schedule(models.Model):
}
return before == now
@property
def end(self):
return self.time + utils.to_timedelta(self.duration)
def match(self, date = None, check_time = True):
"""
Return True if the given datetime matches the schedule

View File

@ -12,18 +12,25 @@
<h2>{% trans "Schedule" %}</h2>
<ul>
{% for schedule in page.program.schedule_set.all %}
<li>
{% with frequency=schedule.get_frequency_display day=schedule.date|date:'l' %}
{% with start=schedule.date|date:"H:i" end=schedule.end|date:"H:i" %}
{% with frequency=schedule.get_frequency_display day=schedule.date|date:'l' %}
{% with start_hour=schedule.time.hour start_minute=schedule.time.minute %}
{% with duration_hour=schedule.duration.hour duration_minute=schedule.duration.minute %}
<li aria-label="{% blocktrans trimmed %}Diffusion on {{ day }} at {{ start_hour }} hours {{ start_minute }}, on the {{ frequency }}, and last for {{ duration_hour }} hours and {{ duration_minute }} minutes {% endblocktrans %}">
{% endwith %}
{% endwith %}
{% with start=schedule.time|date:"H:i" duration=schedule.duration|time:"H\"i" %}
{% blocktrans trimmed %}
{{ day }} at {{ start }} until {{ end }}, <span class="info">{{ frequency }}</span>
{{ day }} at {{ start }} ({{ duration }}), <span class="info">{{ frequency }}</span>
{% endblocktrans %}
{% endwith %}
{% endwith %}
{% if schedule.initial %}
<span class="info">{% trans "Rerun" %}</span>
{% endif %}
{% endwith %}
</li>
{% endwith %}
{% endfor %}
</ul>
{% else %}