Skip to content

Commit

Permalink
Use field.id_for_label instead of field.auto_id
Browse files Browse the repository at this point in the history
This fixes a bug when specifying a custom id for a field and rendering
it with the `|bootstrap` filter.

When using `field.auto_id` in the label's `for` attribute, this is
always set to the default value instead of the custom `id`.
  • Loading branch information
nikolas committed Apr 1, 2015
1 parent 629d82d commit 0b18be1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bootstrapform/templates/bootstrapform/field.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
</div>
{% else %}
{% if field.auto_id %}
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}"
for="{{ field.id_for_label }}">{{ field.label }}</label>
{% endif %}

<div class="{{ classes.value }} {% if field|is_multiple_checkbox %}multiple-checkbox{% endif %}">
Expand Down

0 comments on commit 0b18be1

Please sign in to comment.