forked from ScoDoc/DocScoDoc
Amélioration édition module
This commit is contained in:
parent
45449f0465
commit
6596bd778c
@ -272,7 +272,7 @@ def module_edit(
|
||||
from app.scodoc import sco_tag_module
|
||||
|
||||
# --- Détermination de la formation
|
||||
orig_semestre_idx = None
|
||||
orig_semestre_idx = semestre_id
|
||||
ue = None
|
||||
if create:
|
||||
if matiere_id:
|
||||
@ -331,10 +331,16 @@ def module_edit(
|
||||
)
|
||||
|
||||
semestres_indices = list(range(1, parcours.NB_SEM + 1))
|
||||
# Toutes les UE de la formation (tout parcours):
|
||||
# Toutes les UEs de la formation (tout parcours):
|
||||
ues = formation.ues.order_by(
|
||||
UniteEns.semestre_idx, UniteEns.numero, UniteEns.acronyme
|
||||
).all()
|
||||
# L'UE de rattachement par défaut: 1ere du semestre
|
||||
ue_default = (
|
||||
formation.ues.filter_by(semestre_idx=orig_semestre_idx)
|
||||
.order_by(UniteEns.numero, UniteEns.acronyme)
|
||||
.first()
|
||||
)
|
||||
|
||||
# --- Titre de la page
|
||||
if create:
|
||||
@ -535,6 +541,13 @@ def module_edit(
|
||||
"default": formation.id,
|
||||
},
|
||||
),
|
||||
(
|
||||
"semestre_id",
|
||||
{
|
||||
"input_type": "hidden",
|
||||
"default": orig_semestre_idx,
|
||||
},
|
||||
),
|
||||
]
|
||||
if module:
|
||||
descr += [
|
||||
@ -582,6 +595,7 @@ def module_edit(
|
||||
for u in ues
|
||||
],
|
||||
"allowed_values": [u.id for u in ues],
|
||||
"default": ue_default.id if ue_default is not None else "",
|
||||
},
|
||||
),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user