mirror of
https://github.com/django/django.git
synced 2025-11-20 11:36:04 +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
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue