mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 21:14:49 +08:00
fix tests
This commit is contained in:
@@ -16,9 +16,14 @@ from mypy_django_plugin.plugins.settings import DjangoConfSettingsInitializerHoo
|
|||||||
|
|
||||||
|
|
||||||
def transform_model_class(ctx: ClassDefContext) -> None:
|
def transform_model_class(ctx: ClassDefContext) -> None:
|
||||||
sym = ctx.api.lookup_fully_qualified(helpers.MODEL_CLASS_FULLNAME)
|
try:
|
||||||
if sym is not None and isinstance(sym.node, TypeInfo):
|
sym = ctx.api.lookup_fully_qualified(helpers.MODEL_CLASS_FULLNAME)
|
||||||
sym.node.metadata['django']['model_bases'][ctx.cls.fullname] = 1
|
except KeyError:
|
||||||
|
# models.Model is not loaded, skip metadata model write
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if sym is not None and isinstance(sym.node, TypeInfo):
|
||||||
|
sym.node.metadata['django']['model_bases'][ctx.cls.fullname] = 1
|
||||||
process_model_class(ctx)
|
process_model_class(ctx)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user