-
-
Notifications
You must be signed in to change notification settings - Fork 528
Open
Labels
enhancementNew feature or requestNew feature or requestmypy-pluginIssues specific to mypy_django_pluginIssues specific to mypy_django_plugin
Description
Bug report
What's wrong
django-stubs fails to work with models using django-auto-prefetch.
If I have a class like this:
import
class Bar(auto_prefetch.Model):
bar = CharField(max_length=10)
class Foo(auto_prefetch.Model):
foo = auto_prefetch.ForeignKey(
Bar, on_delete=models.PROTECT
)
and then I try to typecheck this code
def hello(foo: Foo):
print(foo.bar)
I get errors like this:
[...].py:[...]: error: "Model" has no attribute "bar"
How is that should be
Whatever django-stubs is doing to make regular models and ForeignKeys work should also work with models that are inheriting from auto_prefetch.Model.
System information
- OS: macOS 13.1
pythonversion: 3.11djangoversion: 3.2.18mypyversion: 0.961django-stubsversion: 1.12.0django-stubs-extversion: 0.5.0
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestmypy-pluginIssues specific to mypy_django_pluginIssues specific to mypy_django_plugin