Fixed #17796 -- Rolled back [17588] because the fix for the original relatively

corner case (boolean fields under MySQL spatial backend) had a wider scope with
potentially unintended consequences affecting the main MySQL backend and the
required changes wouldn't be appropiate at this point of the 1.4 development
cycle.

Refs #15169.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17603 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales 2012-02-29 17:46:23 +00:00
parent c471cfd674
commit ae640e5ea0
8 changed files with 11 additions and 49 deletions

View file

@ -5,7 +5,10 @@ class SQLCompiler(compiler.SQLCompiler):
values = []
index_extra_select = len(self.query.extra_select.keys())
for value, field in map(None, row[index_extra_select:], fields):
values.append(self.query.convert_values(value, field, connection=self.connection))
if (field and field.get_internal_type() in ("BooleanField", "NullBooleanField") and
value in (0, 1)):
value = bool(value)
values.append(value)
return row[:index_extra_select] + tuple(values)
class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler):