# Buggy code
def _resolve_field_from_parts(
    self, field_parts: Iterable[str], model_cls: Type[Model]
) -> Field:
    currently_observed_model = model_cls
    field = None
    for field_part in field_parts:
        if field_part == "pk":
            field = self.get_primary_key_field(currently_observed_model)
            continue

        field = currently_observed_model._meta.get_field(field_part)
        if isinstance(field, RelatedField):
            currently_observed_model = field.related_model
            model_name = currently_observed_model._meta.model_name
            if model_name is not None and field_part == (model_name + "_id"):
                field = self.get_primary_key_field(currently_observed_model)

        if isinstance(field, ForeignObjectRel):
            currently_observed_model = field.related_model

    assert field is not None
    return field


# Traceback (AttributeError)
Traceback (most recent call last):
File "mypy/checkexpr.py", line 3603, in accept
File "mypy/nodes.py", line 1532, in accept
File "mypy/checkexpr.py", line 264, in visit_call_expr
File "mypy/checkexpr.py", line 341, in visit_call_expr_inner
File "mypy/checkexpr.py", line 730, in check_call_expr_with_callee_type
File "mypy/checkexpr.py", line 789, in check_call
File "mypy/checkexpr.py", line 897, in check_callable_call
File "mypy/checkexpr.py", line 638, in apply_function_plugin
File "/home/christopher/.local/share/virtualenvs/workbench-yfRj1nF_-/home/christopher/.pyenv/shims/python/lib/python3.6/site-packages/mypy_django_plugin/transformers/querysets.py", line 184, in extract_proper_type_queryset_values
lookup=field_lookup, method='values')
File "/home/christopher/.local/share/virtualenvs/workbench-yfRj1nF_-/home/christopher/.pyenv/shims/python/lib/python3.6/site-packages/mypy_django_plugin/transformers/querysets.py", line 57, in get_field_type_from_lookup
lookup_field, method=method)
File "/home/christopher/.local/share/virtualenvs/workbench-yfRj1nF_-/home/christopher/.pyenv/shims/python/lib/python3.6/site-packages/mypy_django_plugin/django/context.py", line 268, in get_field_get_type
is_nullable = self.get_field_nullability(field, method)
File "/home/christopher/.local/share/virtualenvs/workbench-yfRj1nF_-/home/christopher/.pyenv/shims/python/lib/python3.6/site-packages/mypy_django_plugin/django/context.py", line 241, in get_field_nullability
if field.has_default():
AttributeError: 'ManyToManyRel' object has no attribute 'has_default'

# Fixed code
def _resolve_field_from_parts(
    self, field_parts: Iterable[str], model_cls: Type[Model]
) -> Union[Field, ForeignObjectRel]:
    currently_observed_model = model_cls
    field = None
    for field_part in field_parts:
        if field_part == "pk":
            field = self.get_primary_key_field(currently_observed_model)
            continue

        field = currently_observed_model._meta.get_field(field_part)
        if isinstance(field, RelatedField):
            currently_observed_model = field.related_model
            model_name = currently_observed_model._meta.model_name
            if model_name is not None and field_part == (model_name + "_id"):
                field = self.get_primary_key_field(currently_observed_model)

        if isinstance(field, ForeignObjectRel):
            currently_observed_model = field.related_model

    assert field is not None
    return field