# Buggy code
def get_field_set_type(
    self, api: TypeChecker, field: Field, *, method: str
) -> MypyType:
    """Get a type of __set__ for this specific Django field."""
    target_field = field
    if isinstance(field, ForeignKey):
        target_field = field.target_field

    field_info = helpers.lookup_class_typeinfo(api, target_field.__class__)
    if field_info is None:
        return AnyType(TypeOfAny.from_error)

    field_set_type = helpers.get_private_descriptor_type(
        field_info,
        "_pyi_private_set_type",
        is_nullable=self.get_field_nullability(field, method),
    )
    if isinstance(target_field, ArrayField):
        argument_field_type = self.get_field_set_type(
            api, target_field.base_field, method=method
        )
        field_set_type = helpers.convert_any_to_type(
            field_set_type, argument_field_type
        )
    return field_set_type


# 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_set_type(
    self, api: TypeChecker, field: Union[Field, ForeignObjectRel], *, method: str
) -> MypyType:
    """Get a type of __set__ for this specific Django field."""
    target_field = field
    if isinstance(field, ForeignKey):
        target_field = field.target_field

    field_info = helpers.lookup_class_typeinfo(api, target_field.__class__)
    if field_info is None:
        return AnyType(TypeOfAny.from_error)

    field_set_type = helpers.get_private_descriptor_type(
        field_info,
        "_pyi_private_set_type",
        is_nullable=self.get_field_nullability(field, method),
    )
    if isinstance(target_field, ArrayField):
        argument_field_type = self.get_field_set_type(
            api, target_field.base_field, method=method
        )
        field_set_type = helpers.convert_any_to_type(
            field_set_type, argument_field_type
        )
    return field_set_type