-
-
Notifications
You must be signed in to change notification settings - Fork 457
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
RawQuerySet
has conflicting errors: "is not subscriptable" vs "Missing type parameter"
#2236
Comments
RawQuerySet
has conflicting errors: "is not subscriptable" vs "Missing type parameter"
Looks like django-stubs/ext/django_stubs_ext/patch.py Lines 55 to 81 in 590f033
A PR is welcome for fixing that |
As a work-around, you can also use quoted type hints, e.g. def foo() -> "RawQuerySet[MyModel]":
return MyModel.objects.raw("SELECT id FROM my_model") or alternatively, add |
Bug report
What's wrong
Using
RawQuerySet
as type annotation is not possible.Without the generic parameter, mypy fails with
is not subscriptable
error.With the generic parameter, python throws
TypeError
.System information
python
version: 3.12.3django
version: 5.0.6mypy
version: 1.10django-stubs
version: 5.0.2django-stubs-ext
version: 5.0.2The text was updated successfully, but these errors were encountered: