Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid returning None from get_field_related_model_cls #1956

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions mypy_django_plugin/django/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ def get_field_related_model_cls(self, field: Union["RelatedField[Any, Any]", For
else:
related_model_cls = field.field.model

if related_model_cls is None:
raise UnregisteredModelError

flaeppe marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(related_model_cls, str):
if related_model_cls == "self": # type: ignore[unreachable]
# same model
Expand Down