From 835990a81e87918c63bf3986231a428be0f22116 Mon Sep 17 00:00:00 2001 From: Nekori Date: Mon, 14 Jun 2021 18:44:17 +0200 Subject: [PATCH] Fix: erreur suppr --- app/routes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index 4341420..4df68a0 100644 --- a/app/routes.py +++ b/app/routes.py @@ -7,6 +7,7 @@ import app.models as models @app.route("/index", methods=["GET","POST"]) def index(): form = AccueilForm() + valide = form.validate_on_submit() if form.ajouter.data: for i in range(1,7): semestre = models.Semestre(num=i) @@ -20,6 +21,8 @@ def index(): form.exportJSON() elif form.exporterYAML.data: form.exportYAML() + elif form.importer.data and valide: + form.importRef() semestres = sorted(models.Semestre.query.all(), key=lambda semestre: semestre.num) return render_template("index.html", semestres=semestres, form=form) @@ -68,7 +71,7 @@ def Semestre(num): codeClass, code = coeffield.objetformation.data[1:-1].split() model = getattr(models, codeClass) objetformation = model.query.filter_by(code=code).first() - if objetformation in querySAE or objetformation in queryRessource: + if objetformation in list(set(querySAE)&set(field.saes.data)) or objetformation in list(set(queryRessource)&set(field.ressources.data)): objetformation.setCoef(coeffield.coef.data, ue) db.session.commit() return redirect(url_for("Semestre", num=num))