Skip to content
Snippets Groups Projects
Commit 7c074fdc authored by HeJ's avatar HeJ
Browse files

backoffice: fix SoS display ordering

closes #602
parent 13210e06
No related branches found
No related tags found
No related merge requests found
......@@ -36,8 +36,12 @@
<tbody>
{% for event in events %}
<tr class="{% if not event.is_public %}text-muted{% endif %}">
<td>{{ event.schedule_start }}</td>
<td>{{ event.schedule_duration }}</td>
<td data-order="{{ event.schedule_start|date:"U" }}">
<abbr title="{{ event.schedule_start|date:"c" }}">{{ event.schedule_start|conference_time:conference }}</abbr>
</td>
<td data-order="{{ event.schedule_duration.total_seconds|default:"0" }}">
{{ event.schedule_duration|naturaltimespan }}
</td>
<td>
{% if user_list and event.kind == 'sos' %}
<a href="{% url 'backoffice:sos-edit' pk=event.pk %}">{{ event.name }}</a>
......
......@@ -45,8 +45,11 @@ def get_language_item(dictionary):
@register.filter
def naturaltimespan(x):
assert isinstance(x, timedelta), str.format('Expected a timedelta object: {0!r}', x)
def naturaltimespan(x: timedelta) -> str or None:
if x is None:
return ''
if not isinstance(x, timedelta):
raise ValueError('Expected a timedelta object.')
seconds = x.total_seconds()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment