Opened 10 years ago

Closed 10 years ago

Last modified 5 years ago

#3671 closed Uncategorized (fixed)

Specify a selected item in widget.RadioSelect() for a BooleanField

Reported by: David Larlet <larlet@…> Owned by: Adrian Holovaty
Component: Forms Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Here is my model:

foo = forms.BooleanField(widget=widgets.RadioSelect(choices=[(1, 'Yes'), (2, 'No')]))

I can't specify 'No' as default choice of my radio input.

Change History (2)

comment:1 Changed 10 years ago by David Larlet <larlet@…>

Resolution: fixed
Status: newclosed

Ok, forget about that and sorry for the noise.

Solution is initial='2' in BooleanField.

comment:2 in reply to:  description Changed 5 years ago by fazal.sulaiman@…

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

foo = forms.BooleanField(widget=widgets.RadioSelect(choices=[(1, 'Yes'), (2, 'No')]), initial='1')

Replying to David Larlet <larlet@…>:

Here is my model:

foo = forms.BooleanField(widget=widgets.RadioSelect(choices=[(1, 'Yes'), (2, 'No')]))

I can't specify 'No' as default choice of my radio input.

Note: See TracTickets for help on using tickets.
Back to Top