It seem we get an weird behavior on custom manager when subclassing an abstract model defined on another module.
What's wrong
Following the official suggestions I have:
# module A
class MyQuerySet(models.Queryset):
# my methods
MyManager = models.Manager.from_queryset(MyQuerySet)
class BaseModel(models.Model):
# model fields
objects = MyManager()
# On module B
from module_a import BaseModel
class MyModel(BaseModel)
# more fields
On the initial run and presuming I have no other error everything works fine. With any code change
I get errors Could not resolve manager type for "module_b.MyModel".
The weird thing is that if I erase the .mypy_cache dir mypy want complain, but again on every code change
the errors get back.
Bug report
It seem we get an weird behavior on custom manager when subclassing an abstract model defined on another module.
What's wrong
Following the official suggestions I have:
On the initial run and presuming I have no other error everything works fine. With any code change I get errors
Could not resolve manager type for "module_b.MyModel"
.The weird thing is that if I erase the
.mypy_cache
dir mypy want complain, but again on every code change the errors get back.System information
python
version: 3.9django
version: 4.0mypy
version: 0.961django-stubs
version: 1.12.0django-stubs-ext
version: 0.5.0