I have several ModelForms used to build surveys, whose models contain lots of questions (>30 each). At the moment, the multiple choice questions are represented as a <select> element, but to improve UX I'd like to change this to radio buttons.
As it's a ModelForm, I rely on django to automatically create the fields on the form. So while I know it's possible to change each field on the form by doing this:
class SurveyForm(ModelForm):
...
field_one = forms.ChoiceField(choices=CHOICES, widget=forms.RadioSelect())
these definitions don't currently exist, and I'd have to create at least 150 of those definitions. I'm sure there's a better way to override where the widget choice is made (perhaps extending ModelForm?). Or alternatively, could I do this by attaching the widget to the field definition?
I've taken a look through the Django docs and source, but I can't find where the widget is chosen for model fields with a choices kwarg.