views:

20

answers:

1

I have a form class that looks like this:

class ApplicationDetailsForm(ModelForm):
    worked_in_industry = forms.TypedChoiceField(coerce=int, 
                         choices=((1, 'Yes'), (0, 'No')), 
                         widget=forms.RadioSelect())

    class Meta:
        model = ApplicantDetails
        fields = ('work_experience', 'license_level', 'license_duration',      
                  'expected_salary')

The field worked_in_industry is a BooleanField that I've modified to be rendered as Yes/No radio buttons. My problem is that the field isn't saved when my form is processed...all the other fields are saved correctly except the radio button fields. What's my problem?

In the processing view, I've also added:

if job.is_valid():
    application = job.save(commit=False)
    worked_in_industry = job.cleaned_data['worked_in_industry']
A: 

you should include "worked_in_industry" in the fields Meta variable.

KillianDS
Can't believe it was that simple...I'm almost beating myself up!! Thanks KillianDS
Stephen