# Buggy code
def get_field_get_type(
    self, api: TypeChecker, field: Field, *, method: str
) -> MypyType:
    """Get a type of __get__ for this specific Django field."""
    field_info = helpers.lookup_class_typeinfo(api, field.__class__)
    if field_info is None:
        return AnyType(TypeOfAny.unannotated)

    is_nullable = self.get_field_nullability(field, method)
    if isinstance(field, RelatedField):
        related_model_cls = self.get_field_related_model_cls(field)
        if related_model_cls is None:
            return AnyType(TypeOfAny.from_error)

        if method == "values":
            primary_key_field = self.get_primary_key_field(related_model_cls)
            return self.get_field_get_type(api, primary_key_field, method=method)

        model_info = helpers.lookup_class_typeinfo(api, related_model_cls)
        if model_info is None:
            return AnyType(TypeOfAny.unannotated)

        return Instance(model_info, [])
    else:
        return helpers.get_private_descriptor_type(
            field_info, "_pyi_private_get_type", is_nullable=is_nullable
        )


# 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 get_field_get_type(
    self, api: TypeChecker, field: Union[Field, ForeignObjectRel], *, method: str
) -> MypyType:
    """Get a type of __get__ for this specific Django field."""
    field_info = helpers.lookup_class_typeinfo(api, field.__class__)
    if field_info is None:
        return AnyType(TypeOfAny.unannotated)

    is_nullable = self.get_field_nullability(field, method)
    if isinstance(field, RelatedField):
        related_model_cls = self.get_field_related_model_cls(field)
        if related_model_cls is None:
            return AnyType(TypeOfAny.from_error)

        if method == "values":
            primary_key_field = self.get_primary_key_field(related_model_cls)
            return self.get_field_get_type(api, primary_key_field, method=method)

        model_info = helpers.lookup_class_typeinfo(api, related_model_cls)
        if model_info is None:
            return AnyType(TypeOfAny.unannotated)

        return Instance(model_info, [])
    else:
        return helpers.get_private_descriptor_type(
            field_info, "_pyi_private_get_type", is_nullable=is_nullable
        )