mirror of
https://github.com/django/django.git
synced 2025-11-01 12:25:37 +00:00
Fixed #20649 -- Allowed blank field display to be defined in the initial list of choices.
This commit is contained in:
parent
a1889397a9
commit
1123f45511
8 changed files with 152 additions and 8 deletions
|
|
@ -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')))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue