Bug report
What's wrong
In version 6.0.7, using .values() to group the queryset, makes the type-checker ignore any following annotated values. For example, in:
variable = Foo.objects.filter(foo=2).values("bar").annotate(_annotated_value=Value(3))
mypy thinks that variable is a dict with a single key "bar", but that's not true.
How is that should be
"_annotated_value" is also part of the type.
System information
- OS: macOS 26.5
python version: 3.14.6
django version: 5.2.16
mypy version: 2.3.0
django-stubs version: 6.0.7
django-stubs-ext version: 6.0.7
Bug report
What's wrong
In version 6.0.7, using
.values()to group the queryset, makes the type-checker ignore any following annotated values. For example, in:mypy thinks that
variableis a dict with a single key"bar", but that's not true.How is that should be
"_annotated_value"is also part of the type.System information
pythonversion: 3.14.6djangoversion: 5.2.16mypyversion: 2.3.0django-stubsversion: 6.0.7django-stubs-extversion: 6.0.7