My model is like
class mymodel(models.Model): param1=models.NullBooleanField(blank=False)
My form is
class MyForm01(forms.Form): LCHOICES=[(True, 'Yes'),(False,'No')] answer=forms.ChoiceField( label='Question', choices=LCHOICES, widget=forms.RadioSelect(), help_text='Help text')
I am trying to pass the user choice to a model for saving as below, where id_number is a new number for new object creation.
myobj=mymodel.objects.create( id=mymodel.objects.get(id=id_number), param1=form.cleaned_data.['answer'] )
Everything happens, including new object creation but the data passed is always True even when the original answer is negative. If I take a print of answer its coming as False. Also if I change form.cleaned_data.['answer'] to False, it is well accepted.
Where am I making a mistake?