Django 1.8 changed meta api, see docstr in compat.get_all_related_objects()

    :param opts: Options instance
    :return: list of many-to-many relations

def get_all_related_many_to_many_objects(opts):
    """
    Django 1.8 changed meta api, see docstr in compat.get_all_related_objects()

    :param opts: Options instance
    :return: list of many-to-many relations
    """
    if django.VERSION < (1, 9):
        return opts.get_all_related_many_to_many_objects()
    else:
        return [r for r in opts.related_objects if r.field.many_to_many]