Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rest_framework-stubs/fields.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Field(Generic[_VT, _DT, _RP, _IN]):
def get_validators(self) -> list[Validator[_VT]]: ...
def get_initial(self) -> _VT | None: ...
def get_value(self, dictionary: Mapping[Any, Any]) -> Any: ...
def get_attribute(self, instance: _IN) -> _RP | None: ...
def get_attribute(self, instance: _IN) -> _VT | None: ...
def get_default(self) -> _VT | None: ...
def validate_empty_values(self, data: Any) -> tuple[bool, Any]: ...
def run_validation(self, data: Any = ...) -> Any: ...
Expand Down
6 changes: 3 additions & 3 deletions rest_framework-stubs/relations.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _MT = TypeVar("_MT", bound=Model)
_DT = TypeVar("_DT") # Data Type
_PT = TypeVar("_PT") # Primitive Type

class RelatedField(Field[_MT, _DT, _PT, Any]):
class RelatedField(Field[_MT | PKOnlyObject, _DT, _PT, Any]):
queryset: QuerySet[_MT] | Manager[_MT] | None
html_cutoff: int | None
html_cutoff_text: str | None
Expand Down Expand Up @@ -68,7 +68,7 @@ class RelatedField(Field[_MT, _DT, _PT, Any]):
@property
def grouped_choices(self) -> dict: ...
def iter_options(self) -> Iterable[Option]: ...
def get_attribute(self, instance: _MT) -> _PT | None: ...
def get_attribute(self, instance: _MT) -> _MT | PKOnlyObject | None: ...
def display_value(self, instance: _MT) -> str: ...

class StringRelatedField(RelatedField[_MT, _MT, str]): ...
Expand Down Expand Up @@ -160,7 +160,7 @@ class SlugRelatedField(RelatedField[_MT, str, str]):
style: dict[str, str] | None = ...,
) -> None: ...
def to_internal_value(self, data: Any) -> _MT: ...
def to_representation(self, obj: _MT) -> str: ...
def to_representation(self, obj: _MT | PKOnlyObject) -> str: ...

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