Multi-line location field, new field for admission time

This commit is contained in:
Raphael Michel
2017-05-10 12:58:57 +02:00
parent c9ae65a9a8
commit aac05727ed
10 changed files with 126 additions and 22 deletions

View File

@@ -10,6 +10,7 @@ from django.db.models import Count, Prefetch, Q
from django.http import Http404, HttpResponse
from django.shortcuts import redirect
from django.utils.decorators import method_decorator
from django.utils.formats import date_format
from django.utils.functional import cached_property
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
@@ -149,6 +150,11 @@ class EventIcalDownload(EventViewMixin, View):
else:
vevent.add('dtend').value = event.date_to.astimezone(self.event_timezone).date()
if event.date_admission:
vevent.add('description').value = str(_('Admission: {datetime}')).format(
datetime=date_format(event.date_admission.astimezone(self.event_timezone), 'SHORT_DATETIME_FORMAT')
)
resp = HttpResponse(cal.serialize(), content_type='text/calendar')
resp['Content-Disposition'] = 'attachment; filename="{}-{}.ics"'.format(
event.organizer.slug, event.slug