django-stubs
django-stubs copied to clipboard
Make as_manager() in queryset generic instead of using Any
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 would you please send a PR?
@sobolevn done!
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.