From 9c2ce8952287cc626cb8babad2a9ad23098b0c24 Mon Sep 17 00:00:00 2001 From: Marian Sigler Date: Mon, 24 Sep 2012 03:34:46 +0200 Subject: templates/_macros: move errors in own macro --- templates/_macros.html | 26 +++++++++++++++----------- templates/register.html | 1 - 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'templates') 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 }}
{{ field(**kwargs)|safe }} - {%- if field.errors|length == 1 %} -
- {{ field.errors.0 }} -
- {% elif field.errors %} - - {% endif %} + {{ render_errors(field.errors) }}
{%- endmacro %} + +{% macro render_errors(errors) %} + {%- if errors|length == 1 %} +
+ {{ errors.0 }} +
+ {% elif errors %} + + {% 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.errors }} {{ render_field(form.username) }} {{ render_field(form.mail) }} {{ form.csrf_token }} -- cgit v1.2.3-1-g7c22