Skip to content

Commit

Permalink
Add new model field choices options (#229)
Browse files Browse the repository at this point in the history
I wanted to add the callable option but noticed the mapping option was added too.
  • Loading branch information
georgek authored Feb 25, 2024
1 parent 40bdfe3 commit 7e36372
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions django-stubs/db/models/fields/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ipaddress
import uuid
from collections.abc import Callable, Iterable, Sequence
from datetime import date, datetime, time, timedelta
from typing import Any, Generic, TypeVar, overload
from typing import Any, Generic, Mapping, TypeVar, overload
from typing_extensions import Literal, Self

from django.core.checks import CheckMessage
Expand All @@ -17,7 +17,9 @@ BLANK_CHOICE_DASH: list[tuple[str, str]] = ...

_Choice = tuple[Any, str]
_ChoiceNamedGroup = tuple[str, Iterable[_Choice]]
_FieldChoices = Iterable[_Choice | _ChoiceNamedGroup]
_ChoicesMapping = Mapping[Any, str | Mapping[Any, str]]
_LiteralFieldChoices = Iterable[_Choice | _ChoiceNamedGroup] | _ChoicesMapping
_FieldChoices = _LiteralFieldChoices | Callable[[], _LiteralFieldChoices]

_ValidatorCallable = Callable[..., None]
_ErrorMessagesToOverride = dict[str, Any]
Expand Down

0 comments on commit 7e36372

Please sign in to comment.