首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Django CMS Show_Menu示例不适用于多级菜单

Django CMS Show_Menu示例不适用于多级菜单
EN

Stack Overflow用户
提问于 2019-05-28 18:01:28
回答 1查看 329关注 0票数 0

base.html:

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                   {% show_menu 0 1 100 100 "menu.html" %}
                </ul>

            </div>

menu.html:

{% load i18n menu_tags cache %}
{% for child in children %}
    <li class="child{% if child.selected %} selected{% endif %}{% if child.ancestor %} ancestor{% endif %}{% if child.sibling %} sibling{% endif %}{% if child.descendant %} descendant{% endif %}{% if child.children %} dropdown{% endif %}">

        <a {% if child.children %}class="dropdown-toggle" data-toggle="dropdown"{% endif %} href="{{ child.attr.redirect_url|default:child.get_absolute_url }}">
            <span>{{ child.get_menu_title }}</span>{% if child.children|length %}<span class="caret"></span>{% endif %}
        </a>

        {% if child.children %}
            <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
                {% show_menu from_level to_level extra_inactive extra_active "dropdownmenu.html" "" "" child %}
            </ul>
        {% endif %}

    </li>
    {% if class and forloop.last and not forloop.parentloop %}{% endif %}

{% endfor %}

dropdownmenu.html:

{% load i18n menu_tags cache  %}
{% for child in children %}
    <li {% if child.children %}class="dropdown-submenu"{% else %} {% endif %}>
        <a tabindex="-1" href="{{ child.attr.redirect_url|default:child.get_absolute_url }}">{{ child.get_menu_title }}</a>
        {% if child.children %}
            <ul class="dropdown-menu">
                {% show_menu from_level to_level extra_inactive extra_active "dropdownmenu.html" "" "" child %}
            </ul>
        {% endif %}

    </li>
{% endfor %}

子菜单不显示

EN

回答 1

Stack Overflow用户

发布于 2019-06-04 08:42:15

我就是遇到了这个问题。我发布了页面,然后我可以在渲染菜单中看到它们。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56339679

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档