1
0
forked from ScoDoc/ScoDoc

Assiduites : edit_justificatif_etud - retour à la page précédente (back_url) closes #864

This commit is contained in:
Iziram 2024-03-22 08:46:05 +01:00
parent 2daae1c9c5
commit 0fbcfb1124
2 changed files with 6 additions and 2 deletions

View File

@ -5,7 +5,7 @@ Gestion des listes d'assiduités et justificatifs
from datetime import datetime from datetime import datetime
from flask import url_for from flask import url_for, request
from flask_login import current_user from flask_login import current_user
from flask_sqlalchemy.query import Query from flask_sqlalchemy.query import Query
from sqlalchemy import desc, literal, union, asc from sqlalchemy import desc, literal, union, asc
@ -606,6 +606,7 @@ class RowAssiJusti(tb.Row):
"assiduites.edit_justificatif_etud", "assiduites.edit_justificatif_etud",
justif_id=self.ligne["obj_id"], justif_id=self.ligne["obj_id"],
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
back_url=request.url,
) )
else: else:
url = url_for( url = url_for(

View File

@ -660,11 +660,14 @@ def edit_justificatif_etud(justif_id: int):
) )
form.etat.data = str(justif.etat) 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", "assiduites.liste_assiduites_etud",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
etudid=justif.etudiant.id, etudid=justif.etudiant.id,
) )
if form.validate_on_submit(): if form.validate_on_submit():
if form.cancel.data: # cancel button if form.cancel.data: # cancel button
return redirect(redirect_url) return redirect(redirect_url)