From 0beea0dfc692a36abbdc6fd8f2ec2cf22f31e894 Mon Sep 17 00:00:00 2001 From: Arthur ZHU Date: Fri, 24 Dec 2021 10:59:02 +0100 Subject: [PATCH] separation script pour chaque template html de formulaire --- app/entreprises/routes.py | 6 +- .../entreprises/ajout_entreprise.html | 56 ++++++++++++++++++ .../entreprises/ajout_historique.html | 31 ++++++++++ .../entreprises/envoi_offre_form.html | 31 ++++++++++ app/templates/entreprises/form.html | 57 ------------------- 5 files changed, 121 insertions(+), 60 deletions(-) create mode 100644 app/templates/entreprises/ajout_entreprise.html create mode 100644 app/templates/entreprises/ajout_historique.html create mode 100644 app/templates/entreprises/envoi_offre_form.html diff --git a/app/entreprises/routes.py b/app/entreprises/routes.py index 681f12425..4808cbebe 100644 --- a/app/entreprises/routes.py +++ b/app/entreprises/routes.py @@ -88,7 +88,7 @@ def add_entreprise(): db.session.commit() flash("L'entreprise a été ajouté à la liste.") return redirect(url_for("entreprises.index")) - return render_template("entreprises/form.html", title=("Ajout entreprise + contact"), form=form) + return render_template("entreprises/ajout_entreprise.html", title=("Ajout entreprise + contact"), form=form) @bp.route("/edit_entreprise/", methods=["GET", "POST"]) def edit_entreprise(id): @@ -331,14 +331,14 @@ def add_historique(id): db.session.commit() flash("L'étudiant a été ajouté sur la fiche entreprise.") return redirect(url_for("entreprises.fiche_entreprise", id=entreprise.id)) - return render_template("entreprises/form.html", title=("Ajout historique"), form=form) + return render_template("entreprises/ajout_historique.html", title=("Ajout historique"), form=form) @bp.route("/envoyer_offre/", methods=["GET", "POST"]) def envoyer_offre(id): form = EnvoiOffreForm() if form.validate_on_submit(): print("tmp") # faire l'envoie du mail - return render_template("entreprises/form.html", title=("Envoyer une offre"), form=form) + return render_template("entreprises/envoi_offre_form.html", title=("Envoyer une offre"), form=form) @bp.route("/etudiants") def json_etudiants(): diff --git a/app/templates/entreprises/ajout_entreprise.html b/app/templates/entreprises/ajout_entreprise.html new file mode 100644 index 000000000..76a9619e4 --- /dev/null +++ b/app/templates/entreprises/ajout_entreprise.html @@ -0,0 +1,56 @@ +{% extends 'base.html' %} +{% import 'bootstrap/wtf.html' as wtf %} + +{% block styles %} +{{super()}} + + +{% endblock %} + +{% block app_content %} +

{{ title }}

+
+
+
+ {{ wtf.quick_form(form, novalidate=True) }} +
+
+ +{% endblock %} \ No newline at end of file diff --git a/app/templates/entreprises/ajout_historique.html b/app/templates/entreprises/ajout_historique.html new file mode 100644 index 000000000..f4da2661b --- /dev/null +++ b/app/templates/entreprises/ajout_historique.html @@ -0,0 +1,31 @@ +{% extends 'base.html' %} +{% import 'bootstrap/wtf.html' as wtf %} + +{% block styles %} +{{super()}} + + +{% endblock %} + +{% block app_content %} +

{{ title }}

+
+
+
+ {{ wtf.quick_form(form, novalidate=True) }} +
+
+ +{% endblock %} \ No newline at end of file diff --git a/app/templates/entreprises/envoi_offre_form.html b/app/templates/entreprises/envoi_offre_form.html new file mode 100644 index 000000000..c9db2c6c1 --- /dev/null +++ b/app/templates/entreprises/envoi_offre_form.html @@ -0,0 +1,31 @@ +{% extends 'base.html' %} +{% import 'bootstrap/wtf.html' as wtf %} + +{% block styles %} +{{super()}} + + +{% endblock %} + +{% block app_content %} +

{{ title }}

+
+
+
+ {{ wtf.quick_form(form, novalidate=True) }} +
+
+ +{% endblock %} \ No newline at end of file diff --git a/app/templates/entreprises/form.html b/app/templates/entreprises/form.html index 25cb579dd..26add23e1 100644 --- a/app/templates/entreprises/form.html +++ b/app/templates/entreprises/form.html @@ -15,61 +15,4 @@ {{ wtf.quick_form(form, novalidate=True) }} - {% endblock %} \ No newline at end of file