Skip to content Skip to sidebar Skip to footer

Django Models Radio Input

I am trying to incorporate radio buttons in my form. In my forms.py I have the following fields for the form : class ProfileForm(forms.ModelForm): class Meta: model = P

Solution 1:

I don't know why you say you "cannot use widgets either". Of course you can, in the form Meta class:

class ProfileForm(forms.ModelForm):
    class Meta:
        model = Profile
        fields = ['first_name', 'last_name', 'gender']
        widgets = {'gender': forms.RadioInput}

Post a Comment for "Django Models Radio Input"