mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-17 17:35:59 +08:00
Add ValidationError type hints (#767)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, Iterator, List, Mapping, Optional, Tuple, Union
|
from typing import Any, Dict, Iterator, List, Literal, Mapping, Optional, Tuple, Union
|
||||||
|
|
||||||
from django.forms.utils import ErrorDict
|
from django.forms.utils import ErrorDict
|
||||||
|
|
||||||
@@ -24,15 +24,20 @@ class MiddlewareNotUsed(Exception): ...
|
|||||||
class ImproperlyConfigured(Exception): ...
|
class ImproperlyConfigured(Exception): ...
|
||||||
class FieldError(Exception): ...
|
class FieldError(Exception): ...
|
||||||
|
|
||||||
NON_FIELD_ERRORS: str
|
NON_FIELD_ERRORS: Literal["__all__"]
|
||||||
|
|
||||||
class ValidationError(Exception):
|
class ValidationError(Exception):
|
||||||
error_dict: Any = ...
|
error_dict: Dict[str, ValidationError] = ...
|
||||||
error_list: Any = ...
|
error_list: List[ValidationError] = ...
|
||||||
message: Any = ...
|
message: str = ...
|
||||||
code: Any = ...
|
code: Optional[str] = ...
|
||||||
params: Any = ...
|
params: Optional[Mapping[str, Any]] = ...
|
||||||
def __init__(self, message: Any, code: Optional[str] = ..., params: Optional[Mapping[str, Any]] = ...) -> None: ...
|
def __init__(
|
||||||
|
self,
|
||||||
|
message: Union[str, ValidationError, Dict[str, Any], List[Any]],
|
||||||
|
code: Optional[str] = ...,
|
||||||
|
params: Optional[Mapping[str, Any]] = ...,
|
||||||
|
) -> None: ...
|
||||||
@property
|
@property
|
||||||
def message_dict(self) -> Dict[str, List[str]]: ...
|
def message_dict(self) -> Dict[str, List[str]]: ...
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user