Radio buttons in django Forms

Look at setting the field's widget and choices when writing the form class.

CHOICES=[('select1','select 1'),
         ('select2','select 2')]

like = forms.ChoiceField(choices=CHOICES, widget=forms.RadioSelect)

The default widget is a drop down select.


Remember to remove all the external styling, and then add the code below:

CHOICES = [('M','Male'),('F','Female')]
Gender=forms.CharField(label='Gender', widget=forms.RadioSelect(choices=CHOICES))

The above code generates Radio buttons.

In my case, I was using a style.css file which was forcing the radio button to render as a list.