I just upgraded from django 2.0.2 to 4.1.1.
I have a few form fields of type ChoiceField with forms.RadioSelect. In django 2.0.2 the tag included a 'for' attribute/id so I can query in the template
{% if field.id_for_label == "xyz" %}. However in 4.1.1 the 'for' attribute/id is not included (when inspecting the html source generated), so field.id_for_label is empty.
All other fields labels still include 'for' attributes/id.
Questions:
- Has anyone seen this problem?
- Is there a way to 'force' a 'for' attribute on the labels?
- Is there some other way to identify a field? I tried ...
{% if field.label_tag == "label text" %}, but no good.
@doug-nintzel. Probably i initiated this change in last version of Django.
If i take the radio-widget template code, here:
i see, you can use:
instead of
field.id_for_label