back soft

مطالب مرتبط با «not able to swallow» در back soft | نویسنده: استخدام کار

Not able to pass logical answer received from Form to NullBoolean model

Vote count: 0 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...

ادامه مطلب

برچسب‌های مرتبط

not able to sleep | not able to | not able to read | not able to hear | not able to connect to internet | not able to breathe | not able to swallow | not able to download apps | not able to pee