aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/templates
diff options
context:
space:
mode:
authorRodney Ewing <ewing.rj@gmail.com>2013-06-26 08:29:03 -0700
committerRodney Ewing <ewing.rj@gmail.com>2013-07-11 16:29:16 -0700
commitf7998c3326d7c2ed06a978f721cf6533fbde1c15 (patch)
treecbd0afface6f3186aff1482d8fd40e6fb0046989 /mediagoblin/templates
parent0ec7ce4ec684ebeb205e7dfa3f3f08a814074297 (diff)
downloadmediagoblin-f7998c3326d7c2ed06a978f721cf6533fbde1c15.tar.lz
mediagoblin-f7998c3326d7c2ed06a978f721cf6533fbde1c15.tar.xz
mediagoblin-f7998c3326d7c2ed06a978f721cf6533fbde1c15.zip
fix for boolean fields
Diffstat (limited to 'mediagoblin/templates')
-rw-r--r--mediagoblin/templates/mediagoblin/utils/wtforms.html47
1 files changed, 29 insertions, 18 deletions
diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html
index a4c33f1a..2b2cc30a 100644
--- a/mediagoblin/templates/mediagoblin/utils/wtforms.html
+++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html
@@ -34,26 +34,26 @@
{# Generically render a field #}
{% macro render_field_div(field, autofocus_first=False) %}
- {{- render_label_p(field) }}
- <div class="form_field_input">
- {% if autofocus_first %}
- {{ field(autofocus=True) }}
- {% else %}
- {{ field }}
- {% endif %}
- {%- if field.errors -%}
- {% for error in field.errors %}
- <p class="form_field_error">{{ error }}</p>
- {% endfor %}
- {%- endif %}
- {%- if field.description %}
- {% if field.type == 'BooleanField' %}
- <label for="{{ field.label.field_id }}">{{ field.description|safe }}</label>
+ {% if field.type == 'BooleanField' %}
+ {{ render_bool(field) }}
+ {% else %}
+ {{- render_label_p(field) }}
+ <div class="form_field_input">
+ {% if autofocus_first %}
+ {{ field(autofocus=True) }}
{% else %}
- <p class="form_field_description">{{ field.description|safe }}</p>
+ {{ field }}
{% endif %}
- {%- endif %}
- </div>
+ {%- if field.errors -%}
+ {% for error in field.errors %}
+ <p class="form_field_error">{{ error }}</p>
+ {% endfor %}
+ {%- endif %}
+ {%- if field.description %}
+ <p class="form_field_description">{{ field.description|safe }}</p>
+ {%- endif %}
+ </div>
+ {% endif %}
{%- endmacro %}
{# Auto-render a form as a series of divs #}
@@ -86,3 +86,14 @@
</tr>
{% endfor %}
{%- endmacro %}
+
+{# Render a boolean field #}
+{% macro render_bool(field) %}
+ <div id="boolean">
+ <label for="{{ field.label.field_id }}">
+ {{ field }}</input>
+ {{ field.description|safe }}
+ </label>
+</div>
+{% endmacro %}
+