A simple form with ModelChoiceField displayed as radio buttons (the inherited widget).
I'm using an onchange event to POST, everytime a user selects a radio button:
shipping_choice = ShippingChoiceField(
queryset=ShippingMethods.objects.all(),
empty_label=None,
widget=forms.RadioSelect(attrs={
'class': 'order',
'onchange': '$("#shipping_choice").submit()',
})
)
I need to have the radio that the user selected thought, actually be "selected" when the page reloads.
Adding an extra attr 'selected', will not do, 'cause it needs to happen when the user actually has made a choice first.