def get_field_type(field, include_role=True):
    '\n    Get the type of a field including the correct intersphinx mappings.\n\n    :param field: The field\n    :type field: ~django.db.models.Field\n\n    :param include_directive: Whether or not the role :any:`py:class` should be included\n    :type include_directive: bool\n\n    :return: The type of the field\n    :rtype: str\n    '
    if isinstance(field, models.fields.related.RelatedField):
        if isinstance(field.remote_field.model, str):
            to = field.remote_field.model
        else:
            to = f'{field.remote_field.model.__module__}.{field.remote_field.model.__name__}'
        return f':class:`~{type(field).__module__}.{type(field).__name__}` to :class:`~{to}`'
    elif isinstance(field, models.fields.reverse_related.ForeignObjectRel):
        to = field.remote_field.model
        return f'Reverse :class:`~{type(field.remote_field).__module__}.{type(field.remote_field).__name__}` from :class:`~{to.__module__}.{to.__name__}`'
    elif include_role:
        return f':class:`~{type(field).__module__}.{type(field).__name__}`'
    else:
        return f'~{type(field).__module__}.{type(field).__name__}'
Get the type of a field including the correct intersphinx mappings.

:param field: The field
:type field: ~django.db.models.Field

:param include_directive: Whether or not the role :any:`py:class` should be included
:type include_directive: bool

:return: The type of the field
:rtype: str
def get_field_type(field, include_role=True):
    '\n    Get the type of a field including the correct intersphinx mappings.\n\n    :param field: The field\n    :type field: ~django.db.models.Field\n\n    :param include_directive: Whether or not the role :any:`py:class` should be included\n    :type include_directive: bool\n\n    :return: The type of the field\n    :rtype: str\n    '
    if isinstance(field, models.fields.related.RelatedField):
        if isinstance(field.remote_field.model, str):
            to = field.remote_field.model
        else:
            to = f'{field.remote_field.model.__module__}.{field.remote_field.model.__name__}'
        return f':class:`~{type(field).__module__}.{type(field).__name__}` to :class:`~{to}`'
    elif isinstance(field, models.fields.reverse_related.ForeignObjectRel):
        to = field.remote_field.model
        return f'Reverse :class:`~{type(field.remote_field).__module__}.{type(field.remote_field).__name__}` from :class:`~{to.__module__}.{to.__name__}`'
    elif include_role:
        return f':class:`~{type(field).__module__}.{type(field).__name__}`'
    else:
        return f'~{type(field).__module__}.{type(field).__name__}'