juanefren
juanefren

Reputation: 2958

Render Radio Button Django

I Have this Form

class MyModelForm(forms.ModelForm):
boolfield = forms.TypedChoiceField(coerce=bool,
               choices=((False, 'No'), (True, 'Yes')),
               widget=forms.RadioSelect
            )

class Meta:
     model = MyModel

How can I show the buttons without LI an UL tags ? (I want to show them together horizontally), and how to set False selected by default? ()

Upvotes: 0

Views: 555

Answers (1)

kennethlove
kennethlove

Reputation: 83

Setting the initial property on the field should select False.

You can also custom render the field to display them how you want. You could also define a new widget, but I don't have a link handy for that.

Upvotes: 1

Related Questions