From 29d295db61cca1cf80afd3985d9914e806d30e37 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 2 Feb 2022 10:23:40 +0100 Subject: [PATCH] =?UTF-8?q?Edition=20UE=20BUT:=20semestre=20par=20d=C3=A9f?= =?UTF-8?q?aut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_edit_ue.py | 16 ++++++++++------ app/templates/pn/form_ues.html | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index b5c3d4ab2..0615db1e8 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -231,13 +231,17 @@ def do_ue_delete(ue_id, delete_validations=False, force=False): return None -def ue_create(formation_id=None): - """Creation d'une UE""" - return ue_edit(create=True, formation_id=formation_id) +def ue_create(formation_id=None, default_semestre_idx=None): + """Formulaire création d'une UE""" + return ue_edit( + create=True, + formation_id=formation_id, + default_semestre_idx=default_semestre_idx, + ) -def ue_edit(ue_id=None, create=False, formation_id=None): - """Modification ou création d'une UE""" +def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=None): + """Formulaire modification ou création d'une UE""" create = int(create) if not create: U = ue_list(args={"ue_id": ue_id}) @@ -250,7 +254,7 @@ def ue_edit(ue_id=None, create=False, formation_id=None): submitlabel = "Modifier les valeurs" else: title = "Création d'une UE" - initvalues = {} + initvalues = {"semestre_idx": default_semestre_idx} submitlabel = "Créer cette UE" formation = Formation.query.get(formation_id) if not formation: diff --git a/app/templates/pn/form_ues.html b/app/templates/pn/form_ues.html index d6b1fe127..e56e19875 100644 --- a/app/templates/pn/form_ues.html +++ b/app/templates/pn/form_ues.html @@ -46,16 +46,17 @@ {% endfor %} - {% endfor %} {% if editable %} {% endif %} + {% endfor %} \ No newline at end of file