From 1fe1b94afc138e0e425f92fa384161de33567f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Mon, 30 Jan 2017 13:12:01 +0100 Subject: [PATCH] Proper use of messages in events --- gestioncof/templates/{ => gestioncof}/event.html | 3 --- gestioncof/views.py | 9 +++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) rename gestioncof/templates/{ => gestioncof}/event.html (69%) diff --git a/gestioncof/templates/event.html b/gestioncof/templates/gestioncof/event.html similarity index 69% rename from gestioncof/templates/event.html rename to gestioncof/templates/gestioncof/event.html index cc7d96d0..52f893db 100644 --- a/gestioncof/templates/event.html +++ b/gestioncof/templates/gestioncof/event.html @@ -2,9 +2,6 @@ {% block realcontent %}

Événement: {{ event.title }}

- {% if success %} -

Votre inscription a bien été enregistrée ! Vous pouvez cependant la modifier jusqu'à la fin des inscriptions.

- {% endif %} {% if event.details %}

{{ event.details }}

{% endif %} diff --git a/gestioncof/views.py b/gestioncof/views.py index 2a59bd14..ea0de7c8 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -224,8 +224,13 @@ def event(request, event_id): current_choices=current_registration.options) except EventRegistration.DoesNotExist: form = EventForm(event=event) - return render(request, "event.html", - {"event": event, "form": form, "success": success}) + # Messages + if success: + messages.success(request, "Votre inscription a bien été enregistrée ! " + "Vous pouvez cependant la modifier jusqu'à " + "la fin des inscriptions.") + return render(request, "gestioncof/event.html", + {"event": event, "form": form}) def clean_post_for_status(initial):