mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 16:27:09 +08:00
Adjust choices= type variance for model fields (#1154)
Avoid getting stuck in an invariance pit. I don't think it makes sense to mix two tuple with named group elements in same choices sequence(?). This also changes the outermost container type to `Sequence` as e.g. both `tuple` and `list` are supported.
This commit is contained in:
@@ -41,7 +41,7 @@ BLANK_CHOICE_DASH: List[Tuple[str, str]] = ...
|
||||
_Choice = Tuple[Any, Any]
|
||||
_ChoiceNamedGroup = Tuple[str, Iterable[_Choice]]
|
||||
_FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]]
|
||||
_ChoicesList = List[Union[_Choice, _ChoiceNamedGroup]]
|
||||
_ChoicesList = Union[Sequence[_Choice], Sequence[_ChoiceNamedGroup]]
|
||||
_LimitChoicesTo = Union[Q, Dict[str, Any]]
|
||||
|
||||
class _ChoicesCallable(Protocol):
|
||||
|
||||
Reference in New Issue
Block a user