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 ite开发者_C百科m, value is not selected... How can I make to previous selected value be marked
You've used strings for your choices keys. Booleans are True
and False
.
精彩评论