1
0
forked from ScoDoc/ScoDoc

WIP: affichage message erreur

This commit is contained in:
Emmanuel Viennet 2023-12-06 02:35:29 +01:00
parent ec4aed584f
commit ebd7d30176
4 changed files with 15 additions and 5 deletions

View File

@ -41,6 +41,8 @@ from wtforms import (
class AjoutAssiduiteEtudForm(FlaskForm):
"Formulaire de saisie d'une assiduité pour un étudiant"
error_message = "" # used to report our errors
assi_etat = RadioField(
"Signaler:",
choices=[("absent", "absence"), ("retard", "retard"), ("present", "présence")],

View File

@ -1203,6 +1203,16 @@ span.wtf-field ul.errors li,
span.wtf-field-error {
color: red;
}
div.wtf-error-messages {
color: red;
font-size: 110%;
font-weight: bold;
border: 1px solid red;
border-radius: 8px;
background-color: yellow;
padding: 12px;
margin: 12px;
}
#bonus_description {
color: rgb(6, 73, 6);

View File

@ -53,11 +53,9 @@ div.submit > input {
<div class="tab-content">
<h2>Signaler une absence, retard ou présence pour {{etud.html_link_fiche()|safe}}</h2>
{% if 'general_errors' in form.errors %}
{% if form.error_message %}
<div class="wtf-error-messages">
{% for error in form.errors['general_errors'] %}
<span>{{ error }}</span>
{% endfor %}
{{ form.error_message }}
</div>
{% endif %}

View File

@ -442,7 +442,7 @@ def _record_assiduite_etud(
db.session.commit()
return True
except ScoValueError as exc:
form.errors["general_errors"] = [f"Erreur: {exc.args[0]}"]
form.error_message = f"Erreur: {exc.args[0]}"
return False
# # Génération de la page