Merge branch 'Elarnon/vevent-uid' into 'master'
Ajoute un UID aux VEVENTs du calendrier dynamique Fixes #102. See merge request !103
This commit is contained in:
commit
f1c87ab8ad
|
@ -14,6 +14,7 @@ from django.http import Http404, HttpResponse, HttpResponseForbidden
|
|||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.views import login as django_login_view
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.sites.models import Site
|
||||
from django.utils import timezone
|
||||
import django.utils.six as six
|
||||
|
||||
|
@ -710,12 +711,15 @@ def calendar_ics(request, token):
|
|||
tirage__active=True)
|
||||
shows = shows.distinct()
|
||||
vcal = Calendar()
|
||||
site = Site.objects.get_current()
|
||||
for show in shows:
|
||||
vevent = Vevent()
|
||||
vevent.add('dtstart', show.date)
|
||||
vevent.add('dtend', show.date + timedelta(seconds=7200))
|
||||
vevent.add('summary', show.title)
|
||||
vevent.add('location', show.location.name)
|
||||
vevent.add('uid', 'show-{:d}-{:d}@{:s}'.format(
|
||||
show.pk, show.tirage_id, site.domain))
|
||||
vcal.add_component(vevent)
|
||||
if subscription.subscribe_to_events:
|
||||
for event in Event.objects.filter(old=False).all():
|
||||
|
@ -725,6 +729,8 @@ def calendar_ics(request, token):
|
|||
vevent.add('summary', event.title)
|
||||
vevent.add('location', event.location)
|
||||
vevent.add('description', event.description)
|
||||
vevent.add('uid', 'event-{:d}@{:s}'.format(
|
||||
event.pk, site.domain))
|
||||
vcal.add_component(vevent)
|
||||
response = HttpResponse(content=vcal.to_ical())
|
||||
response['Content-Type'] = "text/calendar"
|
||||
|
|
Loading…
Reference in a new issue