#5852: Setting models.NullBooleanField(null=True, blank=True)
-----------------------+----------------------------------------------------
Reporter: ryankanno | Owner: nobody
Status: new | Component: django.newforms
Version: SVN | Keywords:
Stage: Unreviewed | Has_patch: 0
-----------------------+----------------------------------------------------
I have a model that has the following:
{{{
#!python
takes_reservations = models.NullBooleanField(null=True, blank=True)
}}}
In my edit view I perform the following:
{{{
#!python
restaurant = Restaurant.objects.get_restaurant(slug, True)
RestaurantForm = forms.models.form_for_instance(restaurant,
formfield_callback=restaurant_form_callback)
if request.method == 'POST':
post_values = request.POST.copy()
form = RestaurantForm(post_values)
if form.is_valid():
model.save()
}}}
Since the NullBooleanField maps to a CharField (why exactly I'm not sure
;P), if I fill in a value for the CharField, everything is ok. However,
if the CharField is left blank, I get the following error:
{{{
OperationalError at /restaurants/my-restaurant/edit/
(1366, "Incorrect integer value: '' for column 'takes_reservations' at row
1")
Request Method: POST
Request URL: http://wegoeat.com/restaurants/my-restaurant/edit/
Exception Type: OperationalError
Exception Value: (1366, "Incorrect integer value: '' for column
'takes_reservations' at row 1")
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/5852>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---