mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-05-20 07:19:47 +08:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user