-
-
Notifications
You must be signed in to change notification settings - Fork 485
New problem when typing custom Model.objects
in version 1.13.1
#1286
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
Comments
Model.object
in version 1.13.1Model.objects
in version 1.13.1
Similar problem here. I am using VSCode extension from django.db.models import Model
Model.objects # "Go To Definition" works in VSCode
def func(model: Model):
model.objects # "Go To Definition" says "No definition found" Didn't find a way to specify version of |
Pylance actually does not ship with |
@tkoft Thanks for the information, I see the problem is fixed in sbdchd#181 |
I'm closing this as I cannot reproduce with the provided code. Feel free to post a new issue or provide any new repro case here and I'll reopen. |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
What's wrong
After updating to version 1.13.1 I've add a new typing problem appear in my models file. Here is a simplistic version. This file contains two models A and B that can point to each other.
With version 1.13.0 this passes fine, but with 1.13.1 mypy raises an error:
This initial problem can be solved by adding a type annotation:
However that wasn't necessary in the previous version. Moreover this new annotation leads mypy to raise a new error :
This new error is present in both versions 1.13.1 and 1.13.0. I don't know how to fix that one.
How is that should be
I'd expect the annotation to be unneeded as it wasn't in the previous version and it seems clear enough.
With the annotation I would also expect no error here, as my models should be well-typed, and the code runs fine.
System information
python
version: 3.10.7django
version: 4.1.4mypy
version: 0.991django-stubs
version: 1.13.1 (worked on 1.13.0)django-stubs-ext
version: 0.7.0The text was updated successfully, but these errors were encountered: