maraujop/django-crispy-forms — Issue #12: RadioSelect widget doesn't work correctly
Author: ptoal
Created: 2012-02-22 22:11:36+00:00
State: open

I'm trying to make my crispy forms work with formwizard and bootstrap. I noticed that the form wasn't working with a ChoiceField that had a RadioSelect widget.

I tracked it down to the fact that the crispy forms templates render most fields as {% crispy_field field %}, but the RadioSelect uses an {% include %} tag that uses the radioselect.html template. This template appears to work, but puts the wrong value in name="" for the input.

I'm not sure what the "right" answer to this problem is. For now, I have changed my radioselect.html template to use field.html_name instead of field.name, which makes things work. But the bigger question in my mind is: Is this the right way to do things? I.e., should we still be using radioselect.html to render a RadioSelect widget, or should we be using the widgets normal as_widget function, like the others? Of course the problem with doing that is that it wraps the 's in a

, which is undesirable.

Looking forward to discussion on this.

-PT