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

Make as_manager() in queryset generic instead of using Any #324

Closed
silviogutierrez opened this issue Feb 13, 2020 · 3 comments · Fixed by #1025
Closed

Make as_manager() in queryset generic instead of using Any #324

silviogutierrez opened this issue Feb 13, 2020 · 3 comments · Fixed by #1025
Labels
bug Something isn't working

Comments

@silviogutierrez
Copy link

Bug report

What's wrong

as_manager() on querysets currently uses Any instead of _T.

Like so:

# django-stubs/db/models/query.pyi
    @classmethod
    def as_manager(cls) -> Manager[Any]: ...

How is that should be

Looks like a simple switch to _T fixes it:

# django-stubs/db/models/query.pyi
    @classmethod
    def as_manager(cls) -> Manager[_T]: ...

See https://docs.djangoproject.com/en/3.0/topics/db/managers/#creating-a-manager-with-queryset-methods for more info.

@silviogutierrez silviogutierrez added the bug Something isn't working label Feb 13, 2020
@sobolevn
Copy link
Member

@silviogutierrez would you please send a PR?

@silviogutierrez
Copy link
Author

@sobolevn done!

@aitorres
Copy link

Hello! Is there any updates on this issue? Any way I could help make a new PR / update an existing PR to solve it? I just ran into this issue on my project too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
3 participants