@@ -9,14 +9,13 @@ from django import forms
99from django .core import validators # due to weird mypy.stubtest error
1010from django .core .checks import CheckMessage
1111from django .db .backends .base .base import BaseDatabaseWrapper
12- from django .db .models import Choices , Model
12+ from django .db .models import Model
1313from django .db .models .expressions import Col , Combinable , Expression , Func
1414from django .db .models .fields .reverse_related import ForeignObjectRel
1515from django .db .models .query_utils import Q , RegisterLookupMixin
1616from django .db .models .sql .compiler import SQLCompiler , _AsSqlType , _ParamsT
1717from django .forms import Widget
18- from django .utils .choices import BlankChoiceIterator , _Choice , _ChoiceNamedGroup , _ChoicesCallable , _ChoicesMapping
19- from django .utils .choices import _Choices as _ChoicesSequence
18+ from django .utils .choices import BlankChoiceIterator , _Choice , _ChoiceNamedGroup , _ChoicesCallable , _ChoicesInput
2019from django .utils .datastructures import DictWrapper
2120from django .utils .functional import _Getter , _StrOrPromise , cached_property
2221from typing_extensions import Self , TypeAlias
@@ -29,9 +28,6 @@ BLANK_CHOICE_DASH: list[tuple[str, str]]
2928_ChoicesList : TypeAlias = Sequence [_Choice ] | Sequence [_ChoiceNamedGroup ]
3029_LimitChoicesTo : TypeAlias = Q | dict [str , Any ]
3130_LimitChoicesToCallable : TypeAlias = Callable [[], _LimitChoicesTo ]
32- _Choices : TypeAlias = (
33- _ChoicesSequence | _ChoicesMapping | type [Choices ] | Callable [[], _ChoicesSequence | _ChoicesMapping ]
34- )
3531
3632_F = TypeVar ("_F" , bound = Field , covariant = True )
3733
@@ -174,7 +170,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
174170 unique_for_date : str | None = None ,
175171 unique_for_month : str | None = None ,
176172 unique_for_year : str | None = None ,
177- choices : _Choices | None = None ,
173+ choices : _ChoicesInput | None = None ,
178174 help_text : _StrOrPromise = "" ,
179175 db_column : str | None = None ,
180176 db_tablespace : str | None = None ,
@@ -289,7 +285,7 @@ class DecimalField(Field[_ST, _GT]):
289285 editable : bool = ...,
290286 auto_created : bool = ...,
291287 serialize : bool = ...,
292- choices : _Choices | None = ...,
288+ choices : _ChoicesInput | None = ...,
293289 help_text : _StrOrPromise = ...,
294290 db_column : str | None = ...,
295291 db_comment : str | None = ...,
@@ -321,7 +317,7 @@ class CharField(Field[_ST, _GT]):
321317 unique_for_date : str | None = ...,
322318 unique_for_month : str | None = ...,
323319 unique_for_year : str | None = ...,
324- choices : _Choices | None = ...,
320+ choices : _ChoicesInput | None = ...,
325321 help_text : _StrOrPromise = ...,
326322 db_column : str | None = ...,
327323 db_comment : str | None = ...,
@@ -351,7 +347,7 @@ class SlugField(CharField[_ST, _GT]):
351347 unique_for_date : str | None = ...,
352348 unique_for_month : str | None = ...,
353349 unique_for_year : str | None = ...,
354- choices : _Choices | None = ...,
350+ choices : _ChoicesInput | None = ...,
355351 help_text : _StrOrPromise = ...,
356352 db_column : str | None = ...,
357353 db_comment : str | None = ...,
@@ -387,7 +383,7 @@ class URLField(CharField[_ST, _GT]):
387383 unique_for_date : str | None = ...,
388384 unique_for_month : str | None = ...,
389385 unique_for_year : str | None = ...,
390- choices : _Choices | None = ...,
386+ choices : _ChoicesInput | None = ...,
391387 help_text : _StrOrPromise = ...,
392388 db_column : str | None = ...,
393389 db_comment : str | None = ...,
@@ -420,7 +416,7 @@ class TextField(Field[_ST, _GT]):
420416 unique_for_date : str | None = ...,
421417 unique_for_month : str | None = ...,
422418 unique_for_year : str | None = ...,
423- choices : _Choices | None = ...,
419+ choices : _ChoicesInput | None = ...,
424420 help_text : _StrOrPromise = ...,
425421 db_column : str | None = ...,
426422 db_comment : str | None = ...,
@@ -468,7 +464,7 @@ class GenericIPAddressField(Field[_ST, _GT]):
468464 editable : bool = ...,
469465 auto_created : bool = ...,
470466 serialize : bool = ...,
471- choices : _Choices | None = ...,
467+ choices : _ChoicesInput | None = ...,
472468 help_text : _StrOrPromise = ...,
473469 db_column : str | None = ...,
474470 db_comment : str | None = ...,
@@ -503,7 +499,7 @@ class DateField(DateTimeCheckMixin, Field[_ST, _GT]):
503499 editable : bool = ...,
504500 auto_created : bool = ...,
505501 serialize : bool = ...,
506- choices : _Choices | None = ...,
502+ choices : _ChoicesInput | None = ...,
507503 help_text : _StrOrPromise = ...,
508504 db_column : str | None = ...,
509505 db_comment : str | None = ...,
@@ -534,7 +530,7 @@ class TimeField(DateTimeCheckMixin, Field[_ST, _GT]):
534530 editable : bool = ...,
535531 auto_created : bool = ...,
536532 serialize : bool = ...,
537- choices : _Choices | None = ...,
533+ choices : _ChoicesInput | None = ...,
538534 help_text : _StrOrPromise = ...,
539535 db_column : str | None = ...,
540536 db_comment : str | None = ...,
@@ -571,7 +567,7 @@ class UUIDField(Field[_ST, _GT]):
571567 unique_for_date : str | None = ...,
572568 unique_for_month : str | None = ...,
573569 unique_for_year : str | None = ...,
574- choices : _Choices | None = ...,
570+ choices : _ChoicesInput | None = ...,
575571 help_text : _StrOrPromise = ...,
576572 db_column : str | None = ...,
577573 db_comment : str | None = ...,
@@ -608,7 +604,7 @@ class FilePathField(Field[_ST, _GT]):
608604 editable : bool = ...,
609605 auto_created : bool = ...,
610606 serialize : bool = ...,
611- choices : _Choices | None = ...,
607+ choices : _ChoicesInput | None = ...,
612608 help_text : _StrOrPromise = ...,
613609 db_column : str | None = ...,
614610 db_comment : str | None = ...,
0 commit comments