From d443d56659761290ae594831e9e215b74b0634d9 Mon Sep 17 00:00:00 2001 From: Patrick Lauber Date: Mon, 22 Jun 2009 20:24:04 +0800 Subject: [PATCH] some fixes, checkbox is now reverted Signed-off-by: Daniel Greenfeld --- uni_form/templates/uni_form/field.html | 38 ++++++++++++------- .../templates/uni_form/whole_uni_form.html | 6 +-- uni_form/templatetags/uni_form.py | 2 + 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/uni_form/templates/uni_form/field.html b/uni_form/templates/uni_form/field.html index ed369a4..18e8b7a 100644 --- a/uni_form/templates/uni_form/field.html +++ b/uni_form/templates/uni_form/field.html @@ -1,21 +1,33 @@ +{% load uni_form_field %} {% if field.is_hidden %} {{ field }} {% else %} -
+
+ {% if field|is_checkbox %} + {{ field|with_class }} + {% if field.label %} + + {% endif %} + {% else %} + {% if field.label %} + + {% endif %} + {{ field|with_class }} + {% endif %} + {% for error in field.errors %}

- {{ error }} + {{ error }}

- {% endfor %} - {% if field.label %} - - {% endif %} - {{ field }} - {% if field.help_text %} + {% endfor %} + + {% if field.help_text %}

{{ field.help_text }}

- {% endif %} + {% endif %}
- {% endif %} \ No newline at end of file + {% endif %} + \ No newline at end of file diff --git a/uni_form/templates/uni_form/whole_uni_form.html b/uni_form/templates/uni_form/whole_uni_form.html index 94c5268..f5724ae 100644 --- a/uni_form/templates/uni_form/whole_uni_form.html +++ b/uni_form/templates/uni_form/whole_uni_form.html @@ -1,10 +1,10 @@ -{% load uni_form %} +{% load uni_form i18n %}
{% if form_html %}{{ form_html }}{% else %}
- * Required fields - {{ form|as_uni_form }} + * {% trans "Required fields" %} + {{ form|as_uni_form }}
{% endif %} {% if inputs %} diff --git a/uni_form/templatetags/uni_form.py b/uni_form/templatetags/uni_form.py index 563cdc6..c4b8f46 100644 --- a/uni_form/templatetags/uni_form.py +++ b/uni_form/templatetags/uni_form.py @@ -74,6 +74,8 @@ def get_render(self, context): if helper and helper.layout: form_html = helper.render_layout(actual_form) + else: + form_html = "" response_dict = { 'form':actual_form, 'form_html':form_html,