Skip to content

Commit

Permalink
fix(relations): replace the model type TypeVar with Any
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkid committed May 7, 2024
1 parent 5ac16c1 commit 3c65afa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rest_framework-stubs/relations.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ class RelatedField(Field[_MT, Any, _PT, Any]):
def iter_options(self) -> Iterable[Option]: ...
def display_value(self, instance: _MT) -> str: ...

class StringRelatedField(RelatedField[_MT, str]): ...
class StringRelatedField(RelatedField[Any, str]): ...

class PrimaryKeyRelatedField(RelatedField[_MT, Any]):
class PrimaryKeyRelatedField(RelatedField[Any, Any]):
pk_field: str | None
def __init__(
self,
Expand All @@ -98,7 +98,7 @@ class PrimaryKeyRelatedField(RelatedField[_MT, Any]):
pk_field: str | Field | None = ...,
) -> None: ...

class HyperlinkedRelatedField(RelatedField[_MT, Hyperlink]):
class HyperlinkedRelatedField(RelatedField[Any, Hyperlink]):
reverse: Callable
lookup_field: str
lookup_url_kwarg: str
Expand Down Expand Up @@ -129,12 +129,12 @@ class HyperlinkedRelatedField(RelatedField[_MT, Hyperlink]):
lookup_url_kwarg: str | None = ...,
format: str | None = ...,
) -> None: ...
def get_object(self, view_name: str, view_args: list[Any], view_kwargs: dict[str, Any]) -> _MT: ...
def get_object(self, view_name: str, view_args: list[Any], view_kwargs: dict[str, Any]) -> Any: ...
def get_url(self, obj: Model, view_name: str, request: Request, format: str | None) -> str | None: ...

class HyperlinkedIdentityField(HyperlinkedRelatedField): ...

class SlugRelatedField(RelatedField[_MT, str]):
class SlugRelatedField(RelatedField[Any, str]):
slug_field: str | None
def __init__(
self,
Expand All @@ -158,7 +158,7 @@ class SlugRelatedField(RelatedField[_MT, str]):
error_messages: dict[str, StrOrPromise] | None = ...,
style: dict[str, str] | None = ...,
) -> None: ...
def to_internal_value(self, data: Any) -> _MT: ...
def to_internal_value(self, data: Any) -> Any: ...
def to_representation(self, value: _MT) -> str: ...

class ManyRelatedField(Field[Sequence[Any], Sequence[Any], list[Any], Any]):
Expand Down

0 comments on commit 3c65afa

Please sign in to comment.