diff options
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/model_fields/models.py | 1 | ||||
| -rw-r--r-- | tests/regressiontests/model_fields/tests.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/regressiontests/model_fields/models.py b/tests/regressiontests/model_fields/models.py index 5e480aa9a5..72c7beb014 100644 --- a/tests/regressiontests/model_fields/models.py +++ b/tests/regressiontests/model_fields/models.py @@ -69,6 +69,7 @@ class NullBooleanModel(models.Model): class BooleanModel(models.Model): bfield = models.BooleanField() + string = models.CharField(max_length=10, default='abc') ############################################################################### # ImageField diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py index 05b710d885..f0704ff941 100644 --- a/tests/regressiontests/model_fields/tests.py +++ b/tests/regressiontests/model_fields/tests.py @@ -191,6 +191,13 @@ class BooleanFieldTests(unittest.TestCase): self.assertTrue(isinstance(b4.nbfield, bool)) self.assertEqual(b4.nbfield, False) + # http://code.djangoproject.com/ticket/13293 + # Verify that when an extra clause exists, the boolean + # conversions are applied with an offset + b5 = BooleanModel.objects.all().extra( + select={'string_length': 'LENGTH(string)'})[0] + self.assertFalse(isinstance(b5.pk, bool)) + class ChoicesTests(django.test.TestCase): def test_choices_and_field_display(self): """ |
