From 6642f03720e1b195809e366bec23d3c8a30f1bed Mon Sep 17 00:00:00 2001 From: Basile Clement Date: Sat, 5 Nov 2016 18:04:54 +0100 Subject: [PATCH] Ajoute un UID aux VEVENTs du calendrier dynamique Fixes #102. --- gestioncof/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gestioncof/views.py b/gestioncof/views.py index 80f528f7..4f1e5009 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -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"