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 --- account.py | 2 +- templates/_macros.html | 26 +++++++++++++++----------- templates/register.html | 1 - 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/account.py b/account.py index 734ff1d..e037240 100644 --- a/account.py +++ b/account.py @@ -17,7 +17,7 @@ class AccountService: its own authentication request (bind). To test you stuff against our test setup use Port-Forwarding - ssh spline -L 5678:vm-acocunt:389 -N + ssh spline -L 5678:vm-account:389 -N * register a new user >> service = AccountService(LDAP_HOST, LDAP_BASE_DN, ADMIN_USER, ADMIN_PW, SERVICES) 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