This commit is contained in:
Emmanuel Viennet 2022-01-30 09:05:51 +01:00
parent cdc6067861
commit e060be1b3d

View File

@ -700,8 +700,28 @@ def module_edit(module_id=None):
initvalues=module, initvalues=module,
submitlabel="Modifier ce module", submitlabel="Modifier ce module",
) )
# Affiche liste des formseemstre utilisant ce module
if in_use:
formsemestre_ids = {modimpl.formsemestre_id for modimpl in a_module.modimpls}
formsemestres = [FormSemestre.query.get(fid) for fid in formsemestre_ids]
formsemestres.sort(key=lambda f: f.date_debut)
items = [
f"""<a class="stdlink" href="{
url_for("notes.formsemestre_status", scodoc_dept=g.scodoc_dept, formsemestre_id=f.id )
}">{f.titre}</a>"""
for f in formsemestres
]
sem_descr = f"""
<div class="ue_warning">
<div>Ce module est utilisé dans les formsemestres suivants:</div>
<ul><li>
{"</li><li>".join( items )}
</li></ul>
</div>
"""
#
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer() return "\n".join(H) + tf[1] + sem_descr + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return flask.redirect( return flask.redirect(
url_for( url_for(