2👍
✅
The form field in the modelform is a class level property, and not a Meta
property
class TripForm(ModelForm):
CHOICES = (('1', 'First',), ('2', 'Second',))
trip_rating = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES)
class Meta:
model = Trip
exclude = ['user']
should do the trick.
Source:stackexchange.com