Hi, i have a problem when save a field in radio button
in my models have this
CHOICES_OPTIONS = (
 (1, 'Yes'),
(2, 'No'),
)

class MyModels(...):
   myfield = models.IntegerField(choices=CHOICES_OPTIONS, null=True,
blank=True)
   ....

class MyModelsForm()
   myfield = forms.ChoiceField(widget=forms.RadioSelect,
choices=CHOICES_OPTIONS,
   required=False)

but when save the forms in my views this sends this error:

Field 'myfield' expected a number but got ''.

sometimes the user does not select anything neither yes nor no, the radio
button they won't touch it

How can I make that null field be saved without any value and it does not
throw me that error

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM-7rO3gTb%2BdU8dZG-WErBhWmZvArTiAKM_21mxqw5__7Nmavw%40mail.gmail.com.

Reply via email to