mirror of
https://github.com/django/django.git
synced 2025-11-26 21:51:57 +00:00
Fixed #34388 -- Allowed using choice enumeration types directly on model and form fields.
This commit is contained in:
parent
051d5944f8
commit
a2eaea8f22
12 changed files with 48 additions and 19 deletions
|
|
@ -301,11 +301,11 @@ class ValidationTests(SimpleTestCase):
|
|||
f.clean("0", None)
|
||||
|
||||
def test_enum_choices_cleans_valid_string(self):
|
||||
f = models.IntegerField(choices=self.Choices.choices)
|
||||
f = models.IntegerField(choices=self.Choices)
|
||||
self.assertEqual(f.clean("1", None), 1)
|
||||
|
||||
def test_enum_choices_invalid_input(self):
|
||||
f = models.IntegerField(choices=self.Choices.choices)
|
||||
f = models.IntegerField(choices=self.Choices)
|
||||
with self.assertRaises(ValidationError):
|
||||
f.clean("A", None)
|
||||
with self.assertRaises(ValidationError):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue