Cannot resolve manager type when using django-polymorphic with mypy django-stubs

I'm trying to use django-polymorphic to extend a DRF project that uses typeddjango with mypy-stubs. I recently started to use PolymorphicModels and mypy instantly started to complain and throw errors:

error: Could not resolve manager type for "<MyModel>.objects"

I included "polymorphic" and "django.contrib.contenttypes" in the INSTALLED_APPS of the project, and can't really make sense of why mypy keeps complaining. I read about inherited managers in the django-polymorphic doc which could be a cause for troubles, but I didn't manage to identify the root cause to find a fix.

I opened a ticket here: https://github.com/typeddjango/django-stubs/issues/1158 with more details. If anyone has some info, I'd love to hear..

Back to Top