Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing for classes inheriting HyperlinkedIdentityField #537

Closed
Alexerson opened this issue Feb 2, 2024 · 0 comments · Fixed by #530
Closed

Typing for classes inheriting HyperlinkedIdentityField #537

Alexerson opened this issue Feb 2, 2024 · 0 comments · Fixed by #530
Labels
bug Something isn't working

Comments

@Alexerson
Copy link
Contributor

It seems that the following changes introduced a bug:
133e572

It’s possible to not pass any view_name to a HyperlinkedRelatedField if you create a subclass that will define the view_name directly.

For instance:

class BookField(serializers.HyperlinkedRelatedField):
    view_name = 'book-detail'

    def get_queryset(self):
        return Book.objects.all()

is valid.
Right now mypy wrongfully complains with:

error: Missing positional argument "view_name" in call to "BookField"  [call-arg]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
1 participant