From b1e5d205e37a2c0a5d4f42afe0bdce9e0fbf97dd Mon Sep 17 00:00:00 2001
From: Alban Gruin
Date: Thu, 18 Jan 2018 12:06:45 +0100
Subject: Modification de la gestion du formulaire qsjps
Renommage de la template contenant le formulaire
---
templates/form_qsjps.html | 18 ------------------
templates/qsjps_form.html | 18 ++++++++++++++++++
views.py | 11 ++++++-----
3 files changed, 24 insertions(+), 23 deletions(-)
delete mode 100644 templates/form_qsjps.html
create mode 100644 templates/qsjps_form.html
diff --git a/templates/form_qsjps.html b/templates/form_qsjps.html
deleted file mode 100644
index 3a9bcf8..0000000
--- a/templates/form_qsjps.html
+++ /dev/null
@@ -1,18 +0,0 @@
-{% extends "index.html" %}
-
-{% block title %}QSJPS – {% endblock %}
-
-{% block body %}
-
Trouver une salle
-
-{% endblock %}
diff --git a/templates/qsjps_form.html b/templates/qsjps_form.html
new file mode 100644
index 0000000..bc5e363
--- /dev/null
+++ b/templates/qsjps_form.html
@@ -0,0 +1,18 @@
+{% extends "index.html" %}
+
+{% block title %}Trouver une salle – {% endblock %}
+
+{% block body %}
+ Trouver une salle
+
+{% endblock %}
diff --git a/views.py b/views.py
index e8fc259..1c82b03 100644
--- a/views.py
+++ b/views.py
@@ -154,13 +154,14 @@ def qsjps(request):
if form.is_valid():
# Formulaire validé
return None
- else:
- # Formulaire invalide, on le raffiche avec une erreur
- return render(request, "form_qsjps.html", {"form": form})
+ # Si le formulaire est invalide, on ré-affiche le formulaire
+ # avec les erreurs
else:
- # Sinon, affichage d’un formulaire vide
+ # Si le formulaire n’a pas été soumis, on en instancie un
+ # nouveau
form = QSJPSForm()
- return render(request, "form_qsjps.html", {"form": form})
+
+ return render(request, "qsjps_form.html", {"form": form})
def ctx_processor(request):
return {"celcatsanitizer_version": edt.VERSION}
--
cgit v1.2.1