Fix: Semestre non créer -> redirect accueil

This commit is contained in:
Éric Li 2021-06-11 14:24:16 +02:00
parent ba0d6c3ba7
commit 7435478a23
2 changed files with 24 additions and 6 deletions

View File

@ -27,6 +27,9 @@ def index():
def Semestre(num):
form = SemestreForm()
semestre = models.Semestre.query.filter_by(num=num).first()
if semestre == None:
flash("Ce Semestre n'existe pas!", "error")
return redirect(url_for("index"))
for i, ue in enumerate(semestre.ues):
if form.ueform.__len__() < len(semestre.ues): form.ueform.append_entry(data={"ue": ue.code})
# Donne aux dropdowns la liste des objets de formations que les ACs possèdent sans doublons

View File

@ -96,11 +96,26 @@
<!-- Contenu de la page -->
<div class="container">
<div class="box">
{% with messages = get_flashed_messages() %}
{% with messages = get_flashed_messages(category_filter=["error"]) %}
{% if messages %}
<script>
alert("{% for message in messages %}{{message}}{% endfor %}");
</script>
<article class="message is-danger">
<div class="message-body">
{% for message in messages %}
<p>{{message}}</p>
{% endfor %}
</div>
</article>
{% endif %}
{% endwith %}
{% with messages = get_flashed_messages(category_filter=["success"]) %}
{% if messages %}
<article class="message is-success">
<div class="message-body">
{% for message in messages %}
<p>{{message}}</p>
{% endfor %}
</div>
</article>
{% endif %}
{% endwith %}
{% block content %}