﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
5852	Setting models.NullBooleanField(null=True, blank=True)	Ryan Kanno	whiskybar	"
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"")
}}}


"		closed	Forms	dev		fixed			Accepted	0	0	0	0	0	0
