diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/_macros.html | 26 | ||||
-rw-r--r-- | templates/register.html | 1 |
2 files changed, 15 insertions, 12 deletions
diff --git a/templates/_macros.html b/templates/_macros.html index 8298040..265584f 100644 --- a/templates/_macros.html +++ b/templates/_macros.html @@ -3,17 +3,21 @@ {{ field.label }} <div class="controls"> {{ field(**kwargs)|safe }} - {%- if field.errors|length == 1 %} - <div class="errors"> - {{ field.errors.0 }} - </div> - {% elif field.errors %} - <ul class="errors"> - {% for error in field.errors %} - <li>{{ error }}</li> - {% endfor %} - </ul> - {% endif %} + {{ render_errors(field.errors) }} </div> </div> {%- endmacro %} + +{% macro render_errors(errors) %} + {%- if errors|length == 1 %} + <div class="errors"> + {{ errors.0 }} + </div> + {% elif errors %} + <ul class="errors"> + {% for error in errors %} + <li>{{ error }}</li> + {% endfor %} + </ul> + {% endif %} +{%- endmacro %} diff --git a/templates/register.html b/templates/register.html index cdd101d..ab785ea 100644 --- a/templates/register.html +++ b/templates/register.html @@ -4,7 +4,6 @@ {%- set no_login_message = true %} {%- block content %} <form action="{{ url_for('register') }}" method="post" class="form-horizontal"> - {{ form.errors }} {{ render_field(form.username) }} {{ render_field(form.mail) }} {{ form.csrf_token }} |