From 1672b54c8977f01cc3f36301074ed397fd618726 Mon Sep 17 00:00:00 2001 From: w0rp Date: Thu, 24 Mar 2022 17:14:16 -0400 Subject: [PATCH] Set type parameters for Field in get_fields() (#882) * Set type parameters for Field in get_fields() This fixes an issue with Pyright strict type checking where Pyright complains that the type parameters aren't known. * Fix type parameters in other methods --- django-stubs/db/models/options.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django-stubs/db/models/options.pyi b/django-stubs/db/models/options.pyi index 3b2f05ddf..eb3e41e82 100644 --- a/django-stubs/db/models/options.pyi +++ b/django-stubs/db/models/options.pyi @@ -93,8 +93,8 @@ class Options(Generic[_M]): def installed(self): ... def contribute_to_class(self, cls: Type[Model], name: str) -> None: ... def add_manager(self, manager: Manager) -> None: ... - def add_field(self, field: Union[GenericForeignKey, Field], private: bool = ...) -> None: ... - def setup_pk(self, field: Field) -> None: ... + def add_field(self, field: Union[GenericForeignKey, Field[Any, Any]], private: bool = ...) -> None: ... + def setup_pk(self, field: Field[Any, Any]) -> None: ... def setup_proxy(self, target: Type[Model]) -> None: ... def can_migrate(self, connection: Union[BaseDatabaseWrapper, str]) -> bool: ... @property @@ -104,7 +104,7 @@ class Options(Generic[_M]): @property def many_to_many(self) -> List[ManyToManyField]: ... @property - def fields_map(self) -> Dict[str, Union[Field, ForeignObjectRel]]: ... + def fields_map(self) -> Dict[str, Union[Field[Any, Any], ForeignObjectRel]]: ... @property def managers(self) -> List[Manager]: ... @property @@ -119,4 +119,4 @@ class Options(Generic[_M]): def get_path_from_parent(self, parent: Type[Model]) -> List[PathInfo]: ... def get_fields( self, include_parents: bool = ..., include_hidden: bool = ... - ) -> List[Union[Field, ForeignObjectRel]]: ... + ) -> List[Union[Field[Any, Any], ForeignObjectRel]]: ...