Bug report
What's wrong
request.user is inferred as Any | AnonymousUser after upgrading django-stubs to 5.2.0.
#651 used _UserModel from django-stubs, allowing mypy to use the correct type for custom User models. typeddjango/django-stubs@8249ccd refactored the User TypeVars, removing _UserModel.
How is that should be
request.user should be User | AnonymousUser.
System information
- OS: Ubuntu 24.04
python version: 3.13
django version: 5.2
mypy version: 1.15.0
django-stubs version: 5.2.0
I've fixed this locally and I'm happy to submit a PR, but I thought it might be a bit too presumptuous to also bump the django-stubs version (and mypy version to match that used in django-stubs)!