Fix crash if model from same app referenced in RelatedField cannot be resolved (#199)

* do not crash if model from same app refd in ForeignKey cannot be resolved

* bump to 1.2.0
This commit is contained in:
Maxim Kurnikov
2019-10-05 20:00:51 +03:00
committed by GitHub
parent 717be5940f
commit db9ff6aaf6
7 changed files with 69 additions and 11 deletions
+2
View File
@@ -150,6 +150,8 @@ class NewSemanalDjangoPlugin(Plugin):
for field in self.django_context.get_model_fields(model_class):
if isinstance(field, RelatedField):
related_model_cls = self.django_context.get_field_related_model_cls(field)
if related_model_cls is None:
continue
related_model_module = related_model_cls.__module__
if related_model_module != file.fullname():
deps.add(self._new_dependency(related_model_module))