summaryrefslogtreecommitdiff
path: root/tests/model_fields/models.py
diff options
context:
space:
mode:
authorT. Franzel <tfranzel@users.noreply.github.com>2023-03-11 00:34:13 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-03-21 19:44:41 +0100
commita2eaea8f22305b57dff3ab13add2e2887287bb6f (patch)
treea2f1acee503899e52a583572a46aeee0d1a5432c /tests/model_fields/models.py
parent051d5944f86400b9b3476db60bc73de7e9964810 (diff)
Fixed #34388 -- Allowed using choice enumeration types directly on model and form fields.
Diffstat (limited to 'tests/model_fields/models.py')
-rw-r--r--tests/model_fields/models.py7
1 files changed, 7 insertions, 0 deletions
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):