Add fallback related manager in final iteration of AddRelatedManagers (#993)

If a django model has a Manager class that cannot be resolved statically
(if it is generated in a way where we cannot import it, like `objects =
my_manager_factory()`), we fallback to the default related manager, so
you at least get a base level of working type checking.
This commit is contained in:
Aleksander Vognild Burkow
2022-06-15 17:50:53 +02:00
committed by GitHub
parent 32e13c37a6
commit 9044a354cb
3 changed files with 59 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
from mypy.errorcodes import ErrorCode
MANAGER_UNTYPED = ErrorCode("django-manager", "Untyped manager disallowed", "Django")
MANAGER_MISSING = ErrorCode("django-manager-missing", "Couldn't resolve related manager for model", "Django")