forked from ScoDoc/ScoDoc
WIP: affichage message erreur
This commit is contained in:
parent
ec4aed584f
commit
ebd7d30176
@ -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")],
|
||||
|
@ -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);
|
||||
|
@ -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 %}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user