@register.inclusion_tag('forum/forum_list.html', takes_context=True)
def forum_list(context, forums):
    request = context.get('request', None)
    data_dict = {
        'forums': forums,
        'user': request.user,
        'request': request,
    }

    forums_copy = sorted(forums, key=lambda forum: forum.level)
    if forums_copy:
        root_level = forums_copy[0].level
        data_dict['root_level'] = root_level
        data_dict['root_level_middle'] = root_level + 1
        data_dict['root_level_sub'] = root_level + 2

    return data_dict
This will render the given list of forums by respecting the order and the depth of each
dataset/ETHPy150Open ellmetha/django-machina/machina/templatetags/forum_tags.py/forum_list