I have a form class that looks like this:
class ApplicationDetailsForm(ModelForm):
worked_in_industry = forms.TypedChoiceField(coerce=int,
choices=((1, 'Yes'), (0, 开发者_如何学Python'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']
you should include "worked_in_industry" in the fields Meta variable.
加载中,请稍侯......
精彩评论