summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
authorAlex Couper <alex.couper@glassesdirect.com>2013-07-20 21:49:33 +0000
committerTim Graham <timograham@gmail.com>2013-07-31 14:12:03 -0400
commit1123f4551158b7fc65d3bd88c375a4517dcd0720 (patch)
treecfded236931c3360205bf35351d81c75a78ef743 /tests/model_fields
parenta1889397a9f0e6a35189de455098b4c70923e561 (diff)
Fixed #20649 -- Allowed blank field display to be defined in the initial list of choices.
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/tests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 04a17df947..378e6280cc 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -331,6 +331,10 @@ class ValidationTest(test.TestCase):
f = models.CharField(choices=[('a', 'A'), ('b', 'B')])
self.assertRaises(ValidationError, f.clean, "not a", None)
+ def test_charfield_get_choices_with_blank_defined(self):
+ f = models.CharField(choices=[('', '<><>'), ('a', 'A')])
+ self.assertEqual(f.get_choices(True), [('', '<><>'), ('a', 'A')])
+
def test_choices_validation_supports_named_groups(self):
f = models.IntegerField(
choices=(('group', ((10, 'A'), (20, 'B'))), (30, 'C')))