mirror of https://github.com/django/django.git
Fixed #34807 -- Avoided circular import between forms, models, and utils' choices.
Thanks Collin Anderson for the report.
Regression in 500e01073a
.
This commit is contained in:
parent
c74a6fad54
commit
9c68792843
|
@ -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():
|
||||
|
|
Loading…
Reference in New Issue