mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #34388 -- Allowed using choice enumeration types directly on model and form fields.
This commit is contained in:
committed by
Mariusz Felisiak
parent
051d5944f8
commit
a2eaea8f22
@@ -69,11 +69,18 @@ class WhizIterEmpty(models.Model):
|
||||
|
||||
|
||||
class Choiceful(models.Model):
|
||||
class Suit(models.IntegerChoices):
|
||||
DIAMOND = 1, "Diamond"
|
||||
SPADE = 2, "Spade"
|
||||
HEART = 3, "Heart"
|
||||
CLUB = 4, "Club"
|
||||
|
||||
no_choices = models.IntegerField(null=True)
|
||||
empty_choices = models.IntegerField(choices=(), null=True)
|
||||
with_choices = models.IntegerField(choices=[(1, "A")], null=True)
|
||||
empty_choices_bool = models.BooleanField(choices=())
|
||||
empty_choices_text = models.TextField(choices=())
|
||||
choices_from_enum = models.IntegerField(choices=Suit)
|
||||
|
||||
|
||||
class BigD(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user