mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-05-19 23:09:56 +08:00
add Model.__init__ typechecking
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from datetime import time
|
||||
from decimal import Decimal
|
||||
from itertools import chain
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, Iterable
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, Iterable, Sequence
|
||||
|
||||
from django.contrib.admin.options import BaseModelAdmin
|
||||
from django.core.files.base import File
|
||||
@@ -114,6 +114,8 @@ class CheckboxInput(Input):
|
||||
check_test: Callable = ...
|
||||
def __init__(self, attrs: Optional[Dict[str, str]] = ..., check_test: Optional[Callable] = ...) -> None: ...
|
||||
|
||||
_OptAttrs = Dict[str, Any]
|
||||
|
||||
class ChoiceWidget(Widget):
|
||||
allow_multiple_selected: bool = ...
|
||||
input_type: Optional[str] = ...
|
||||
@@ -123,17 +125,9 @@ class ChoiceWidget(Widget):
|
||||
checked_attribute: Any = ...
|
||||
option_inherits_attrs: bool = ...
|
||||
choices: List[List[Union[int, str]]] = ...
|
||||
def __init__(
|
||||
self,
|
||||
attrs: Optional[Dict[str, Union[bool, str]]] = ...,
|
||||
choices: Union[
|
||||
Iterator[Any], List[List[Union[int, str]]], List[Tuple[Union[time, int], int]], List[int], Tuple
|
||||
] = ...,
|
||||
) -> None: ...
|
||||
def options(self, name: str, value: List[str], attrs: Dict[str, Union[bool, str]] = ...) -> None: ...
|
||||
def optgroups(
|
||||
self, name: str, value: List[str], attrs: Optional[Dict[str, Union[bool, str]]] = ...
|
||||
) -> List[Tuple[Optional[str], List[Dict[str, Union[Dict[str, Union[bool, str]], time, int, str]]], int]]: ...
|
||||
def __init__(self, attrs: Optional[_OptAttrs] = ..., choices: Sequence[Tuple[Any, Any]] = ...) -> None: ...
|
||||
def options(self, name: str, value: List[str], attrs: Optional[_OptAttrs] = ...) -> None: ...
|
||||
def optgroups(self, name: str, value: List[str], attrs: Optional[_OptAttrs] = ...) -> Any: ...
|
||||
def create_option(
|
||||
self,
|
||||
name: str,
|
||||
@@ -142,8 +136,8 @@ class ChoiceWidget(Widget):
|
||||
selected: Union[Set[str], bool],
|
||||
index: int,
|
||||
subindex: Optional[int] = ...,
|
||||
attrs: Optional[Dict[str, Union[bool, str]]] = ...,
|
||||
) -> Dict[str, Union[Dict[str, Union[bool, str]], Dict[str, bool], Set[str], time, int, str]]: ...
|
||||
attrs: Optional[_OptAttrs] = ...,
|
||||
) -> Dict[str, Any]: ...
|
||||
def id_for_label(self, id_: str, index: str = ...) -> str: ...
|
||||
|
||||
class Select(ChoiceWidget):
|
||||
@@ -171,11 +165,7 @@ class CheckboxSelectMultiple(ChoiceWidget):
|
||||
class MultiWidget(Widget):
|
||||
template_name: str = ...
|
||||
widgets: List[Widget] = ...
|
||||
def __init__(
|
||||
self,
|
||||
widgets: Union[List[Type[DateTimeBaseInput]], Tuple[Union[Type[TextInput], Input]]],
|
||||
attrs: Optional[Dict[str, str]] = ...,
|
||||
) -> None: ...
|
||||
def __init__(self, widgets: Sequence[Widget], attrs: Optional[_OptAttrs] = ...) -> None: ...
|
||||
@property
|
||||
def is_hidden(self) -> bool: ...
|
||||
def decompress(self, value: Any) -> Optional[Any]: ...
|
||||
@@ -218,7 +208,7 @@ class SelectDateWidget(Widget):
|
||||
day_none_value: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
attrs: None = ...,
|
||||
attrs: Optional[_OptAttrs] = ...,
|
||||
years: Optional[Union[Tuple[Union[int, str]], range]] = ...,
|
||||
months: None = ...,
|
||||
empty_label: Optional[Union[Tuple[str, str], str]] = ...,
|
||||
|
||||
Reference in New Issue
Block a user