diff options
| author | nessita <124304+nessita@users.noreply.github.com> | 2023-09-01 00:44:38 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-01 05:44:38 +0200 |
| commit | 9c6879284315d5119942355c340c3e48f6c65882 (patch) | |
| tree | c2e1a0e2a422101f611361068ca0277a0a17083c /django/utils/choices.py | |
| parent | c74a6fad5475495756a5bdb18b2cab2b68d429bc (diff) | |
Fixed #34807 -- Avoided circular import between forms, models, and utils' choices.
Thanks Collin Anderson for the report.
Regression in 500e01073adda32d5149624ee9a5cb7aa3d3583f.
Diffstat (limited to 'django/utils/choices.py')
| -rw-r--r-- | django/utils/choices.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/utils/choices.py b/django/utils/choices.py index fc8267af34..ccedf828a0 100644 --- a/django/utils/choices.py +++ b/django/utils/choices.py @@ -1,6 +1,5 @@ from collections.abc import Callable, Iterable, Iterator, Mapping -from django.db.models.enums import ChoicesMeta from django.utils.functional import Promise @@ -20,6 +19,8 @@ class CallableChoiceIterator(ChoiceIterator): def normalize_choices(value, *, depth=0): """Normalize choices values consistently for fields and widgets.""" + # Avoid circular import when importing django.forms. + from django.db.models.enums import ChoicesMeta match value: case ChoiceIterator() | Promise() | bytes() | str(): |
