Add end date available property for talk

This commit is contained in:
numahell 2016-10-19 00:21:31 +02:00
parent 54bcf5dab8
commit fc498f476c
2 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,5 @@
from enum import IntEnum
from datetime import timedelta
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
@ -162,6 +163,11 @@ class Talk(PonyConfModel):
else:
return 0
@property
def end_date(self):
return self.start_date + timedelta(minutes=self.duration)
class Meta:
ordering = ('event__id',)

View File

@ -19,7 +19,7 @@
<dl class="dl-horizontal">
<dt>{% trans "Format" %}</dt>
<dd><a href="{{ talk.event.get_absolute_url }}">{{ talk.event }}</a></dd>
<dt>{% trans "Topics:" %}</dt>
<dt>{% trans "Topics" %}</dt>
<dd>{% for topic in talk.topics.all %}
<a href="{{ topic.get_absolute_url }}">{{ topic }}</a>{% if not forloop.last %}, {% endif %}
{% empty %}
@ -37,7 +37,7 @@
<dd>{% if talk.start_date %}
<span class="date">{{ talk.start_date|date:"l d b" }}</span>,
<span class="time">{{ talk.start_date|date:"H:i" }} &ndash;
{{ talk.slot.end|date:"H:i" }}</span>
{{ talk.end_date|date:"H:i" }}</span>
{% else %}<em>{% trans "not defined" %}</em>
{% endif %}
</dd>