diff --git a/django-stubs/core/exceptions.pyi b/django-stubs/core/exceptions.pyi index a0cda202b..1472d7ff4 100644 --- a/django-stubs/core/exceptions.pyi +++ b/django-stubs/core/exceptions.pyi @@ -31,7 +31,7 @@ NON_FIELD_ERRORS: Literal["__all__"] class ValidationError(Exception): error_dict: dict[str, list[ValidationError]] error_list: list[ValidationError] - message: str + message: _StrOrPromise code: str | None params: dict[str, Any] | None def __init__( diff --git a/django-stubs/forms/forms.pyi b/django-stubs/forms/forms.pyi index ab8049184..b061f78ee 100644 --- a/django-stubs/forms/forms.pyi +++ b/django-stubs/forms/forms.pyi @@ -7,6 +7,7 @@ from django.forms.fields import Field from django.forms.renderers import BaseRenderer from django.forms.utils import ErrorDict, ErrorList, _DataT, _FilesT from django.forms.widgets import Media, MediaDefiningClass +from django.utils.functional import _StrOrPromise from django.utils.safestring import SafeString class DeclarativeFieldsMetaclass(MediaDefiningClass): ... @@ -55,7 +56,7 @@ class BaseForm: def as_ul(self) -> SafeString: ... def as_p(self) -> SafeString: ... def non_field_errors(self) -> ErrorList: ... - def add_error(self, field: str | None, error: ValidationError | str) -> None: ... + def add_error(self, field: str | None, error: ValidationError | _StrOrPromise) -> None: ... def has_error(self, field: str | None, code: str | None = ...) -> bool: ... def full_clean(self) -> None: ... def clean(self) -> dict[str, Any] | None: ...