From a2eaea8f22305b57dff3ab13add2e2887287bb6f Mon Sep 17 00:00:00 2001 From: "T. Franzel" Date: Sat, 11 Mar 2023 00:34:13 +0100 Subject: Fixed #34388 -- Allowed using choice enumeration types directly on model and form fields. --- tests/model_fields/models.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/model_fields/models.py') diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index c35dfc2ebe..424a78746d 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -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): -- cgit v1.3