Skip to content

Commit 036517c

Browse files
committed
Use field.id_for_label instead of field.auto_id
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`.
1 parent 629d82d commit 036517c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bootstrapform/templates/bootstrapform/field.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
</div>
4747
{% else %}
4848
{% if field.auto_id %}
49-
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>
49+
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}"
50+
for="{{ field.id_for_label }}">{{ field.label }}</label>
5051
{% endif %}
5152

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

0 commit comments

Comments
 (0)