Skip to content

Commit 1672b54

Browse files
authored
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
1 parent 32a33c3 commit 1672b54

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

django-stubs/db/models/options.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ class Options(Generic[_M]):
9393
def installed(self): ...
9494
def contribute_to_class(self, cls: Type[Model], name: str) -> None: ...
9595
def add_manager(self, manager: Manager) -> None: ...
96-
def add_field(self, field: Union[GenericForeignKey, Field], private: bool = ...) -> None: ...
97-
def setup_pk(self, field: Field) -> None: ...
96+
def add_field(self, field: Union[GenericForeignKey, Field[Any, Any]], private: bool = ...) -> None: ...
97+
def setup_pk(self, field: Field[Any, Any]) -> None: ...
9898
def setup_proxy(self, target: Type[Model]) -> None: ...
9999
def can_migrate(self, connection: Union[BaseDatabaseWrapper, str]) -> bool: ...
100100
@property
@@ -104,7 +104,7 @@ class Options(Generic[_M]):
104104
@property
105105
def many_to_many(self) -> List[ManyToManyField]: ...
106106
@property
107-
def fields_map(self) -> Dict[str, Union[Field, ForeignObjectRel]]: ...
107+
def fields_map(self) -> Dict[str, Union[Field[Any, Any], ForeignObjectRel]]: ...
108108
@property
109109
def managers(self) -> List[Manager]: ...
110110
@property
@@ -119,4 +119,4 @@ class Options(Generic[_M]):
119119
def get_path_from_parent(self, parent: Type[Model]) -> List[PathInfo]: ...
120120
def get_fields(
121121
self, include_parents: bool = ..., include_hidden: bool = ...
122-
) -> List[Union[Field, ForeignObjectRel]]: ...
122+
) -> List[Union[Field[Any, Any], ForeignObjectRel]]: ...

0 commit comments

Comments
 (0)