Skip to content

Commit 323f6db

Browse files
committed
Broaden type annotation for ValidationError to accept lazystr.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 5fe4732 commit 323f6db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

django-stubs/core/exceptions.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
22

3+
from django.utils.functional import _StrPromise
34
from typing_extensions import Literal
45

56
class FieldDoesNotExist(Exception): ...
@@ -35,7 +36,7 @@ class ValidationError(Exception):
3536
def __init__(
3637
self,
3738
# Accepts arbitrarily nested data structure, mypy doesn't allow describing it accurately.
38-
message: Union[str, ValidationError, Dict[str, Any], List[Any]],
39+
message: Union[str, _StrPromise, ValidationError, Dict[str, Any], List[Any]],
3940
code: Optional[str] = ...,
4041
params: Optional[Dict[str, Any]] = ...,
4142
) -> None: ...

0 commit comments

Comments
 (0)