From 0fbcfb11240d93bf4148ec3daa5360a2a69a2433 Mon Sep 17 00:00:00 2001 From: Iziram Date: Fri, 22 Mar 2024 08:46:05 +0100 Subject: [PATCH] =?UTF-8?q?Assiduites=20:=20edit=5Fjustificatif=5Fetud=20-?= =?UTF-8?q?=20retour=20=C3=A0=20la=20page=20pr=C3=A9c=C3=A9dente=20(back?= =?UTF-8?q?=5Furl)=20closes=20#864?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/tables/liste_assiduites.py | 3 ++- app/views/assiduites.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/tables/liste_assiduites.py b/app/tables/liste_assiduites.py index 819c3342..16848eff 100644 --- a/app/tables/liste_assiduites.py +++ b/app/tables/liste_assiduites.py @@ -5,7 +5,7 @@ Gestion des listes d'assiduités et justificatifs from datetime import datetime -from flask import url_for +from flask import url_for, request from flask_login import current_user from flask_sqlalchemy.query import Query from sqlalchemy import desc, literal, union, asc @@ -606,6 +606,7 @@ class RowAssiJusti(tb.Row): "assiduites.edit_justificatif_etud", justif_id=self.ligne["obj_id"], scodoc_dept=g.scodoc_dept, + back_url=request.url, ) else: url = url_for( diff --git a/app/views/assiduites.py b/app/views/assiduites.py index cb0f8f92..08a5e250 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -660,11 +660,14 @@ def edit_justificatif_etud(justif_id: int): ) form.etat.data = str(justif.etat) - redirect_url = url_for( + back_url = request.args.get("back_url", None) + + redirect_url = back_url or url_for( "assiduites.liste_assiduites_etud", scodoc_dept=g.scodoc_dept, etudid=justif.etudiant.id, ) + if form.validate_on_submit(): if form.cancel.data: # cancel button return redirect(redirect_url)