summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorMarian Sigler <m@qjym.de>2012-09-24 03:34:46 +0200
committerMarian Sigler <m@qjym.de>2012-09-24 03:34:46 +0200
commit9c2ce8952287cc626cb8babad2a9ad23098b0c24 (patch)
tree6a7e375170ff9719c8625e62ddc05d46ba71a360 /templates
parent9606704fa0ae06835142d2a67ada661ef203b0c6 (diff)
downloadweb-9c2ce8952287cc626cb8babad2a9ad23098b0c24.tar.gz
web-9c2ce8952287cc626cb8babad2a9ad23098b0c24.tar.bz2
web-9c2ce8952287cc626cb8babad2a9ad23098b0c24.zip
templates/_macros: move errors in own macro
Diffstat (limited to 'templates')
-rw-r--r--templates/_macros.html26
-rw-r--r--templates/register.html1
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 }}