-
-
Notifications
You must be signed in to change notification settings - Fork 521
Closed
Labels
Description
I have tried to use ValuesQuerySet that is returned in:
def post_dates_by_author(author_id: int):
"""Returns published blog posts."""
x = BlogPost.objects.filter(
author__id=author_id,
).values_list('created_at', flat=True)
reveal_type(x)
return xReproduction link: https://github.com/sobolevn/django_stubs_example/blob/master/server/apps/main/logic/repo.py
Output:
» PYTHONPATH="$PYTHONPATH:$PWD" mypy server
server/apps/main/logic/repo.py:20: note: Revealed type is 'django.db.models.query.ValuesQuerySet[server.apps.main.models.BlogPost, datetime.datetime]'
But, it looks like ValuesQuerySet is removed in 1.9, and there's not such class: https://github.com/django/django/blob/aed89adad54a977829c4f180b036033e031ebcc7/docs/releases/1.9.txt#L1069
So, it is not clear how to annotate your function to return ValuesQuerySet when it is missing from django.
antonio-antuan, izmailoff, stevanmilic, natkam, fgs-dbudwin and 3 more