summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/model_fields/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 9e38f0fcf0..7a26fe01e5 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -114,6 +114,16 @@ class ChoicesTests(SimpleTestCase):
self.assertIsNone(Whiz(c=None).get_c_display()) # Blank value
self.assertEqual(Whiz(c='').get_c_display(), '') # Empty value
+ def test_overriding_FIELD_display(self):
+ class FooBar(models.Model):
+ foo_bar = models.IntegerField(choices=[(1, 'foo'), (2, 'bar')])
+
+ def get_foo_bar_display(self):
+ return 'something'
+
+ f = FooBar(foo_bar=1)
+ self.assertEqual(f.get_foo_bar_display(), 'something')
+
def test_iterator_choices(self):
"""
get_choices() works with Iterators.