You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So in making my QuerySets defined as generic so that django-stubs starts to understand .annotate properly I have a problem where I don't want to always recognise that a queryset is annotated.
After I make my queryset generic it starts to complain at me along the lines of
Incompatible return value type (got "MyQuerySet[MyModel@AnnotatedWith[TypedDict({'some_count': Any})], MyModel@AnnotatedWith[TypedDict({'some_count': Any})]]", expected "MyQuerySet[MyModel]") [return-value]
I'd rather not add several hundred TypedDicts for annotations that aren't relevant out of the immediate .filter that uses them.
I'm wondering what y'all think about this situation and whether it's reasonable for mypy to say an annotated queryset is a superset of it's unannotated equivalent?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
So in making my QuerySets defined as generic so that django-stubs starts to understand .annotate properly I have a problem where I don't want to always recognise that a queryset is annotated.
For example
After I make my queryset generic it starts to complain at me along the lines of
I'd rather not add several hundred TypedDicts for annotations that aren't relevant out of the immediate .filter that uses them.
I'm wondering what y'all think about this situation and whether it's reasonable for mypy to say an annotated queryset is a superset of it's unannotated equivalent?
Beta Was this translation helpful? Give feedback.
All reactions