fix for boolean fields
This commit is contained in:
parent
0ec7ce4ec6
commit
f7998c3326
@ -66,7 +66,6 @@ class EditAccountForm(wtforms.Form):
|
||||
[wtforms.validators.Optional(),
|
||||
normalize_user_or_email_field(allow_user=False)])
|
||||
wants_comment_notification = wtforms.BooleanField(
|
||||
label='',
|
||||
description=_("Email me when others comment on my media"))
|
||||
license_preference = wtforms.SelectField(
|
||||
_('License preference'),
|
||||
|
@ -334,6 +334,10 @@ text-align: center;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
#boolean {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
textarea#description, textarea#bio {
|
||||
resize: vertical;
|
||||
height: 100px;
|
||||
|
@ -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 %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user