From 8c7ad24af8f4d322a32b1d44efddb66a2d936f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sat, 16 Jul 2016 18:22:53 +0200 Subject: [PATCH] Doc et meilleure utilisation de l'ORM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Indique a l'utilisateur comment utiliser le calendrier - Utilise l'ORM Django plutôt que des `set` python pour avoir la bonne liste des spectacles. - Rajoute un lien vers le calendrier sur la page “mes places” --- bda/templates/resume_places.html | 3 +++ gestioncof/templates/calendar_subscription.html | 14 ++++++++++++-- gestioncof/views.py | 13 +++++++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/bda/templates/resume_places.html b/bda/templates/resume_places.html index 39711f51..4cc087e0 100644 --- a/bda/templates/resume_places.html +++ b/bda/templates/resume_places.html @@ -12,6 +12,9 @@ {% endfor %}

Total à payer : {{ total|floatformat }}€

+

Ne manque pas un spectacle avec le + calendrier + automatique !

{% else %}

Vous n'avez aucune place :(

{% endif %} diff --git a/gestioncof/templates/calendar_subscription.html b/gestioncof/templates/calendar_subscription.html index 2c2671df..e4facd36 100644 --- a/gestioncof/templates/calendar_subscription.html +++ b/gestioncof/templates/calendar_subscription.html @@ -18,8 +18,18 @@ souscrire aux événements du COF et/ou aux spectacles BdA.

{% if token %} -

Le lien à fournir avec votre application agenda préférée se trouve -ici.

+

Votre calendrier (compatible avec toutes les applications d'agenda) se trouve à +cette adresse.

+ + {% endif %}
diff --git a/gestioncof/views.py b/gestioncof/views.py index a988d3e9..214aa622 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -24,7 +24,7 @@ from gestioncof.forms import UserProfileForm, EventStatusFilterForm, \ SurveyForm, SurveyStatusFilterForm, RegistrationUserForm, \ RegistrationProfileForm, AdminEventForm, EventForm, CalendarForm -from bda.models import Tirage, Attribution +from bda.models import Tirage, Spectacle @login_required @@ -654,11 +654,12 @@ def calendar(request): def calendar_ics(request, token): subscription = get_object_or_404(CalendarSubscription, token=token) - shows = set(subscription.other_shows.all()) \ - | {attr.spectacle - for attr in Attribution.objects.filter( - participant__user=subscription.user, - participant__tirage__active=True)} + shows = subscription.other_shows.all() + if subscription.subscribe_to_my_shows: + shows |= Spectacle.objects.filter( + attribues__participant__user=subscription.user, + tirage__active=True) + shows = shows.distinct() vcal = Calendar() for show in shows: vevent = Vevent()