Дмитрий
Дмитрий

Reputation: 11

Using Radio Button for boolean field in Modelform

in models

choice = models.BooleanField()

in forms I use

choices = (
('1', 'Buy'),
('0', 'Sell'),

)

choice = forms.TypedChoiceField(label=u'Тип предожения', choices=choices, widget=forms.RadioSelect,)

but when i edit item, value is not selected... How can I make to previous selected value be marked

Upvotes: 1

Views: 600

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 600059

You've used strings for your choices keys. Booleans are True and False.

Upvotes: 1

Related Questions