1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #20649 -- Allowed blank field display to be defined in the initial list of choices.

This commit is contained in:
Alex Couper
2013-07-20 21:49:33 +00:00
committed by Tim Graham
parent a1889397a9
commit 1123f45511
8 changed files with 152 additions and 8 deletions

View File

@@ -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')))