Skip to content
Merged
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
4 changes: 2 additions & 2 deletions rest_framework-stubs/relations.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ class HyperlinkedRelatedField(RelatedField[_MT, str, Hyperlink]):
class HyperlinkedIdentityField(HyperlinkedRelatedField): ...

class SlugRelatedField(RelatedField[_MT, str, str]):
slug_field: str | None
slug_field: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the attribute is good 👍

def __init__(
self,
slug_field: str,
slug_field: str | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the parameter isn't really | None if there's an assert prohibiting it.

I'd suggest opening a PR to upstream https://github.com/encode/django-rest-framework instead to remove the default value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*,
many: bool = ...,
allow_empty: bool = ...,
Expand Down
Loading