diff --git a/django-stubs/contrib/admin/checks.pyi b/django-stubs/contrib/admin/checks.pyi index ba57692..f34f94c 100644 --- a/django-stubs/contrib/admin/checks.pyi +++ b/django-stubs/contrib/admin/checks.pyi @@ -1,7 +1,7 @@ from typing import Any, List, Union, Iterable, Optional from django.contrib.admin.options import BaseModelAdmin -from django.core.checks.messages import Error +from django.core.checks.messages import CheckMessage, Error from django.apps.config import AppConfig @@ -11,7 +11,7 @@ def check_admin_app(app_configs: Optional[Iterable[AppConfig]], **kwargs: Any) - def check_dependencies(**kwargs: Any) -> List[_CheckError]: ... class BaseModelAdminChecks: - def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[_CheckError]: ... + def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[CheckMessage]: ... class ModelAdminChecks(BaseModelAdminChecks): ... class InlineModelAdminChecks(BaseModelAdminChecks): ... diff --git a/django-stubs/contrib/admin/options.pyi b/django-stubs/contrib/admin/options.pyi index c2c0ab5..29bb25f 100644 --- a/django-stubs/contrib/admin/options.pyi +++ b/django-stubs/contrib/admin/options.pyi @@ -11,7 +11,7 @@ from django.contrib.admin.sites import AdminSite from django.contrib.admin.views.main import ChangeList from django.contrib.auth.forms import AdminPasswordChangeForm from django.contrib.contenttypes.models import ContentType -from django.core.checks.messages import Error +from django.core.checks.messages import CheckMessage from django.core.paginator import Paginator from django.db.models.base import Model from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField @@ -75,7 +75,7 @@ class BaseModelAdmin: view_on_site: bool = ... show_full_result_count: bool = ... checks_class: Any = ... - def check(self, **kwargs: Any) -> List[Union[str, Error]]: ... + def check(self, **kwargs: Any) -> List[CheckMessage]: ... def formfield_for_dbfield( self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any ) -> Optional[Field]: ... diff --git a/django-stubs/contrib/contenttypes/fields.pyi b/django-stubs/contrib/contenttypes/fields.pyi index d8586ed..9d243fd 100644 --- a/django-stubs/contrib/contenttypes/fields.pyi +++ b/django-stubs/contrib/contenttypes/fields.pyi @@ -1,7 +1,7 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from django.contrib.contenttypes.models import ContentType -from django.core.checks.messages import Error +from django.core.checks.messages import CheckMessage from django.db.models.base import Model from django.db.models.expressions import Combinable from django.db.models.fields.mixins import FieldCacheMixin @@ -41,7 +41,7 @@ class GenericForeignKey(FieldCacheMixin): def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ... def get_filter_kwargs_for_object(self, obj: Model) -> Dict[str, Optional[ContentType]]: ... def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ... - def check(self, **kwargs: Any) -> List[Error]: ... + def check(self, **kwargs: Any) -> List[CheckMessage]: ... def get_cache_name(self) -> str: ... def get_content_type( self, obj: Optional[Model] = ..., id: Optional[int] = ..., using: Optional[str] = ... diff --git a/django-stubs/contrib/staticfiles/finders.pyi b/django-stubs/contrib/staticfiles/finders.pyi index 8645a29..beabe2a 100644 --- a/django-stubs/contrib/staticfiles/finders.pyi +++ b/django-stubs/contrib/staticfiles/finders.pyi @@ -1,13 +1,13 @@ from typing import Any, Iterable, Iterator, List, Mapping, Optional, Union, overload -from django.core.checks.messages import Error +from django.core.checks.messages import CheckMessage from django.core.files.storage import Storage from typing_extensions import Literal searched_locations: Any class BaseFinder: - def check(self, **kwargs: Any) -> List[Error]: ... + def check(self, **kwargs: Any) -> List[CheckMessage]: ... def find(self, path: str, all: bool = ...) -> Optional[Any]: ... def list(self, ignore_patterns: Any) -> Iterable[Any]: ... diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 6e9ae19..fff9869 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -17,7 +17,7 @@ from typing import ( overload, ) -from django.core import checks +from django.core.checks import CheckMessage from django.db.models import Model from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist @@ -132,7 +132,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): ) -> Sequence[Union[_Choice, _ChoiceNamedGroup]]: ... def has_default(self) -> bool: ... def get_default(self) -> Any: ... - def check(self, **kwargs: Any) -> List[checks.Error]: ... + def check(self, **kwargs: Any) -> List[CheckMessage]: ... @property def validators(self) -> List[_ValidatorCallable]: ... def validate(self, value: Any, model_instance: Model) -> None: ... diff --git a/scripts/enabled_test_modules.py b/scripts/enabled_test_modules.py index 31120be..be96cff 100644 --- a/scripts/enabled_test_modules.py +++ b/scripts/enabled_test_modules.py @@ -68,6 +68,9 @@ IGNORED_ERRORS = { 'error: "HttpResponse" has no attribute "streaming_content"', 'error: "HttpResponse" has no attribute "context_data"', ], + 'admin_checks': [ + 'Argument 1 to "append" of "list" has incompatible type "str"; expected "CheckMessage"' + ], 'admin_inlines': [ 'error: "HttpResponse" has no attribute "rendered_content"', ],