I am trying to include radio buttons in my form. In my forms.py , I have the following fields for the form:
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
fields = ['first_name', 'last_name', 'gender']
In my models.py :
user = models.ForeignKey(User, db_column='user_id')
first_name = models.CharField(max_length=250)
last_name = models.CharField(max_length=250
GENDER = (('M', 'Male'), ('F', 'Female'), ('O', 'Other'))
gender = models.CharField(max_length=1, choices=GENDER, null=True)
I want it to genderappear as a radio button, not a CharField. But I know that the model module does not support RadioSelect, and I also can not use the widget. Is there any way to do this?
source
share