mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 21:14:49 +08:00
79 lines
3.2 KiB
Python
79 lines
3.2 KiB
Python
from collections import OrderedDict
|
|
from datetime import date, datetime
|
|
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
|
|
|
|
from django.core.exceptions import ValidationError
|
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
|
from django.db.models.query import QuerySet
|
|
from django.forms.boundfield import BoundField
|
|
from django.forms.fields import Field
|
|
from django.forms.utils import ErrorDict, ErrorList
|
|
from django.forms.widgets import Media, MediaDefiningClass
|
|
from django.http.request import QueryDict
|
|
from django.utils.datastructures import MultiValueDict
|
|
from django.utils.safestring import SafeText
|
|
|
|
class DeclarativeFieldsMetaclass(MediaDefiningClass):
|
|
def __new__(
|
|
mcs: Type[DeclarativeFieldsMetaclass], name: str, bases: Tuple[Type[BaseForm]], attrs: OrderedDict
|
|
) -> Type[BaseForm]: ...
|
|
@classmethod
|
|
def __prepare__(metacls: Any, name: str, bases: Tuple[Type[BaseForm]], **kwds: Any) -> OrderedDict: ...
|
|
|
|
class BaseForm:
|
|
default_renderer: Any = ...
|
|
field_order: Any = ...
|
|
prefix: Any = ...
|
|
use_required_attribute: bool = ...
|
|
is_bound: Any = ...
|
|
data: Any = ...
|
|
files: Any = ...
|
|
auto_id: Any = ...
|
|
initial: Any = ...
|
|
error_class: Any = ...
|
|
label_suffix: Any = ...
|
|
empty_permitted: Any = ...
|
|
fields: Any = ...
|
|
renderer: Any = ...
|
|
def __init__(
|
|
self,
|
|
data: Optional[Union[Dict[str, Union[List[int], int, str]], Dict[str, Union[List[str], str]], QueryDict]] = ...,
|
|
files: Optional[Union[Dict[str, SimpleUploadedFile], MultiValueDict]] = ...,
|
|
auto_id: Optional[Union[bool, str]] = ...,
|
|
prefix: Optional[str] = ...,
|
|
initial: Optional[Union[Dict[str, List[int]], Dict[str, date], Dict[str, str]]] = ...,
|
|
error_class: Type[ErrorList] = ...,
|
|
label_suffix: None = ...,
|
|
empty_permitted: bool = ...,
|
|
field_order: None = ...,
|
|
use_required_attribute: Optional[bool] = ...,
|
|
renderer: Any = ...,
|
|
) -> None: ...
|
|
def order_fields(self, field_order: Optional[List[str]]) -> None: ...
|
|
def __iter__(self) -> Iterator[BoundField]: ...
|
|
def __getitem__(self, name: str) -> BoundField: ...
|
|
@property
|
|
def errors(self) -> ErrorDict: ...
|
|
def is_valid(self) -> bool: ...
|
|
def add_prefix(self, field_name: str) -> str: ...
|
|
def add_initial_prefix(self, field_name: str) -> str: ...
|
|
def as_table(self) -> SafeText: ...
|
|
def as_ul(self) -> SafeText: ...
|
|
def as_p(self) -> SafeText: ...
|
|
def non_field_errors(self) -> ErrorList: ...
|
|
def add_error(self, field: Optional[str], error: Union[ValidationError, str]) -> None: ...
|
|
def has_error(self, field: Any, code: Optional[Any] = ...): ...
|
|
cleaned_data: Any = ...
|
|
def full_clean(self) -> None: ...
|
|
def clean(self) -> Dict[str, Optional[Union[datetime, SimpleUploadedFile, QuerySet, str]]]: ...
|
|
def has_changed(self) -> bool: ...
|
|
def changed_data(self) -> List[str]: ...
|
|
@property
|
|
def media(self) -> Media: ...
|
|
def is_multipart(self): ...
|
|
def hidden_fields(self): ...
|
|
def visible_fields(self): ...
|
|
def get_initial_for_field(self, field: Field, field_name: str) -> Any: ...
|
|
|
|
class Form(BaseForm): ...
|