Fix: Semestre non créer -> redirect accueil
This commit is contained in:
parent
ba0d6c3ba7
commit
7435478a23
@ -27,6 +27,9 @@ def index():
|
|||||||
def Semestre(num):
|
def Semestre(num):
|
||||||
form = SemestreForm()
|
form = SemestreForm()
|
||||||
semestre = models.Semestre.query.filter_by(num=num).first()
|
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):
|
for i, ue in enumerate(semestre.ues):
|
||||||
if form.ueform.__len__() < len(semestre.ues): form.ueform.append_entry(data={"ue": ue.code})
|
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
|
# Donne aux dropdowns la liste des objets de formations que les ACs possèdent sans doublons
|
||||||
|
@ -96,11 +96,26 @@
|
|||||||
<!-- Contenu de la page -->
|
<!-- Contenu de la page -->
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
{% with messages = get_flashed_messages() %}
|
{% with messages = get_flashed_messages(category_filter=["error"]) %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
<script>
|
<article class="message is-danger">
|
||||||
alert("{% for message in messages %}{{message}}{% endfor %}");
|
<div class="message-body">
|
||||||
</script>
|
{% 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 %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
Loading…
Reference in New Issue
Block a user