Django-CMS:如何让当前活动子页面的父项在导航菜单中突出显示?

Django-CMS: How do I get a parent item of a currently active child page to highlight in the navigation menu?

Django CMS 附带的标准 menu.html 看起来真的很简单,但我就是不知道如何突出显示具有当前活动子项的菜单项。

我试过这个:

{% if child.children and child.selected %} active dropdown{% endif %}

但是,出于某种奇怪的原因,那是行不通的。

下面是menu.html的完整代码:

{% load i18n menu_tags cache %}

{% for child in children %}
    <li class="{% if child.ancestor %}ancestor{% endif %}
        {% if child.selected %} active{% endif %}
        {% if child.children %} dropdown{% endif %}
 --->   {% if child.selected and child.children %} active dropdown{% endif %}">
        {% if child.children %}
            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                {{ child.get_menu_title }} <span class="caret"></span>
            </a>
            <ul class="dropdown-menu">
                {% show_menu from_level to_level extra_inactive extra_active template "" "" child %}
            </ul>
        {% else %}
            <a href="{{ child.get_absolute_url }}"><span>{{ child.get_menu_title }}</span></a>
        {% endif %}
    </li>
    {% if class and forloop.last and not forloop.parentloop %}{% endif %}
{% endfor %}

感谢 Divio 的 Martin Koistinen,我得到了一个可行的解决方案:

模板标签及其配置:

{% show_menu 0 1 0 0 "menu.html" %}

Menu.html:

{% load i18n menu_tags cache %}

{% for child in children %}
<li class="{% if child.ancestor %}ancestor{% endif %}{% if child.selected %} active{% endif %}">
    <a href="{{ child.get_absolute_url }}">{{ child.get_menu_title }}</a>
    </li>
{% endfor %}