diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-05-03 11:51:37 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-05-03 11:51:37 +0000 |
| commit | 48cffd9e459d8aaf9d1afa36f4e07f9624b2c4ad (patch) | |
| tree | 926bd05f80a3866f8e586f5a0512daad8171fd2e /tests/regressiontests | |
| parent | 18d2f4a81611fa4051ccdcfb9dd443f3a247102e (diff) | |
Fixed #5931 -- Added __repr__ to db fields. Thanks, Thomas Güttler, emulbreh and magopian.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/model_fields/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py index 3ec9d7a8b7..b42c0af784 100644 --- a/tests/regressiontests/model_fields/tests.py +++ b/tests/regressiontests/model_fields/tests.py @@ -48,6 +48,15 @@ class BasicFieldTests(test.TestCase): except ValidationError, e: self.fail("NullBooleanField failed validation with value of None: %s" % e.messages) + def test_field_repr(self): + """ + Regression test for #5931: __repr__ of a field also displays its name + """ + f = Foo._meta.get_field('a') + self.assertEqual(repr(f), '<django.db.models.fields.CharField: a>') + f = models.fields.CharField() + self.assertEqual(repr(f), '<django.db.models.fields.CharField>') + class DecimalFieldTests(test.TestCase): def test_to_python(self): f = models.DecimalField(max_digits=4, decimal_places=2) |
