django-stubs icon indicating copy to clipboard operation
django-stubs copied to clipboard

Make as_manager() in queryset generic instead of using Any

Open silviogutierrez opened this issue 5 years ago • 3 comments

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 avatar Feb 13 '20 02:02 silviogutierrez

@silviogutierrez would you please send a PR?

sobolevn avatar Feb 13 '20 06:02 sobolevn

@sobolevn done!

silviogutierrez avatar Feb 13 '20 16:02 silviogutierrez

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.

aitorres avatar Mar 25 '22 17:03 aitorres