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

Error typechecking ManyToManyField manager request.user.groups.all() #883

Closed
willbeaufoy opened this issue Mar 24, 2022 · 0 comments · Fixed by #1719
Closed

Error typechecking ManyToManyField manager request.user.groups.all() #883

willbeaufoy opened this issue Mar 24, 2022 · 0 comments · Fixed by #1719
Labels
bug Something isn't working

Comments

@willbeaufoy
Copy link

Bug report

What's wrong

If I use request.user.groups.all() in a view (request being an instance of django.http.HttpRequest), this runs fine but mypy complains with

error: Item "ManyToManyField[Sequence[Group], RelatedManager[Group]]" of "Union[ManyToManyField[Sequence[Group], RelatedManager[Group]], EmptyManager]" has no attribute "all"

How is that should be

Typechecking should pass without errors.

System information

  • OS: Ubuntu 20.04
  • python version: 3.9.10
  • django version: 4.0.2
  • mypy version: 0.910
  • django-stubs version: 1.9.0
  • django-stubs-ext version: 0.3.1
@willbeaufoy willbeaufoy added the bug Something isn't working label Mar 24, 2022
flooie added a commit to freelawproject/courtlistener that referenced this issue Dec 30, 2022
Also reported as a mistake
see: typeddjango/django-stubs#883

Who agrees this is not an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant