Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

512
Visualizações
Developing django-cms dropdown menus

I'm new to django and django-cms. I read the official docs and tried to find any other info on the internet, that could guide me through making dropdown menus in django cms. But unfortunately for me, the official docs are really raw (I don't get it at all what's about the menus) and on the internet there's nothing sensible enough.

Please explain me or give a step by step guide on this topic.

At this moment the menu is working and the only code that I have for that is a pair of <ul> and this {% show_menu 0 100 100 100 %} inside them.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The most simple way to get dropdowns working in django-cms is to follow this: (In this example I am using Bootstrap code for my menu)

  1. In your base.html file (or any other name that you are using) use this way of showing your menu {% show_menu 0 10 10 10 %} As an example, this is what i used in my code in base.html to render the menu:

    <ul>
        {% show_menu 0 10 10 10 "menu/custom-menu.html" %}
    </ul>
    
  2. Now create the template in the directory "/templates/menu/custom-menu.html" with these sekizai tags and similar html code that will overwrite your base.html and render your menu with drop-down elements:

    <div class="dropdown">
        {% for child in children %}
    <!-- no child pages  -->
            {% if child.is_leaf_node %}
                <li><a href="{{ child.get_absolute_url }}">{{child.get_menu_title }}</a></li>
            {% endif %}
    <!-- /no child pages  -->
    <!-- has child pages  -->
            {% if not child.is_leaf_node or child.ancestor %}
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    {{child.get_menu_title }}<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        {% if child.get_descendants %}
                            {% for kid in child.get_descendants %}
                                <li>
                                    <a href="{{ kid.get_absolute_url }}">
                                        {{kid.get_menu_title }}
                                    </a>
                                </li>
                            {% endfor %}
                        {% endif %}
                    </ul>
                </li>
            {% endif %}
    <!-- /has child pages  -->
        {% endfor %} 
    <!-- /end for child -->
    </div>
    
  3. And dont forget to put the {% load menu_tags %} sekizai tag in the top of your custom-menu.html file.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda