diff --git a/django/db/backends/mysql/compiler.py b/django/db/backends/mysql/compiler.py
index 07832f2..535bec4 100644
a
|
b
|
from django.db.models.sql import compiler
|
3 | 3 | class SQLCompiler(compiler.SQLCompiler): |
4 | 4 | def resolve_columns(self, row, fields=()): |
5 | 5 | values = [] |
6 | | for value, field in map(None, row, fields): |
| 6 | index_extra_select = len(self.query.extra_select.keys()) |
| 7 | for value, field in map(None, row[index_extra_select:], fields): |
7 | 8 | if (field and field.get_internal_type() in ("BooleanField", "NullBooleanField") and |
8 | 9 | value in (0, 1)): |
9 | 10 | value = bool(value) |
10 | 11 | values.append(value) |
11 | | return tuple(values) |
| 12 | return tuple(values[:index_extra_select] + values) |
12 | 13 | |
13 | 14 | |
14 | 15 | class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler): |
diff --git a/tests/regressiontests/model_fields/models.py b/tests/regressiontests/model_fields/models.py
index 5e480aa..72c7beb 100644
a
|
b
|
class NullBooleanModel(models.Model):
|
69 | 69 | |
70 | 70 | class BooleanModel(models.Model): |
71 | 71 | bfield = models.BooleanField() |
| 72 | string = models.CharField(max_length=10, default='abc') |
72 | 73 | |
73 | 74 | ############################################################################### |
74 | 75 | # ImageField |
diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py
index 05b710d..cfb7d58 100644
a
|
b
|
class BooleanFieldTests(unittest.TestCase):
|
191 | 191 | self.assertTrue(isinstance(b4.nbfield, bool)) |
192 | 192 | self.assertEqual(b4.nbfield, False) |
193 | 193 | |
| 194 | # http://code.djangoproject.com/ticket/13293 |
| 195 | # Verify that extra select clauses are handled correctly |
| 196 | b5 = BooleanModel.objects.all().extra( |
| 197 | select={'string_length': 'LENGTH(string)'})[0] |
| 198 | self.assertFalse(isinstance(b5.pk, bool)) |
| 199 | |
194 | 200 | class ChoicesTests(django.test.TestCase): |
195 | 201 | def test_choices_and_field_display(self): |
196 | 202 | """ |