-
-
Notifications
You must be signed in to change notification settings - Fork 458
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
reveal_type(User.objects.filter) returns UserManager rather than QuerySet[User] #635
Comments
@kracekumar does this happen with other models? Or only with |
@sobolevn It happens for all the models. from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField("date published")
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
reveal_type(Question.objects.filter(id=1))
reveal_type(Choice.objects.filter(id=1)) output
|
Yes, I can confirm: https://github.com/typeddjango/django-stubs/pull/636/checks?check_run_id=2754398770#step:7:249
|
I think this is because the stub for QuerySet has |
Yes, this is exactly the cause! |
This currently has the drawback that error messages display the internal type _QuerySet, with both type arguments. See also discussion on typeddjango#661 and typeddjango#608. Fixes typeddjango#635: QuerySet methods on Managers (like .all()) now return QuerySets rather than Managers. Address code review by @sobolevn.
Bug report
output
What's wrong
The output should
QuerySet[django.contrib.auth.models.User]
I don't know this is mypy bug or stubs bug.
How is that should be
QuerySet[django.contrib.auth.models.User]
System information
OSX
python
version:3.9.4
django
version:3.2
mypy
version:0.812
django-stubs
version:1.8.0
Mypy config
The text was updated successfully, but these errors were encountered: