Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#3671 closed Uncategorized (fixed)

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

Reported by: David Larlet <larlet@…> Owned by: adrian
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 8 years ago by David Larlet <larlet@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to fixed
  • Status changed from new to closed

Ok, forget about that and sorry for the noise.

Solution is initial='2' in BooleanField.

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

  • Easy pickings unset
  • Severity set to Normal
  • Type set to 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