0
votes

I'm trying to run project using Django-cms 3.6.0. It was created using Django-cms 2.3.8, I'm trying to use the old code. In this new version the menu with subpages links doesn't appear. children variable in template doesn't seem to contain anything.
I expect it to show links to 4 subpages of a page. I've added pages manually in admin UI in new version of django-cms.
subbase.html:

{% extends "base.html" %}
{% load i18n %}
{% load menu_tags cms_tags %}
...
{% block left_menu %}
<nav id="lMenu">
 {% show_menu 1 1 0 1 "menu/sub_menu.html" %}
 {% block left_content %}{% endblock left_content %}
</nav>
{% endblock left_menu %}

sub_menu.html:

{% load menu_tags %}
<ul class="subMenu">
 {% for child in children %}
 <li><a href="{{ child.attr.redirect_url|default:child.get_absolute_url }}" title="{{ child.get_menu_title }}">{{ child.get_menu_title }}</a></li>
 {% endfor %}
</ul>

I've checked in database, using manage.py shell, that those pages has child pages:

from cms.models.pagemodel import Page
pages = Page.object.all()
children = pages[2].get_descendant_pages()

And now, e.g., calling pages[2].get_menu_title(), children[0].get_menu_title() returns expected proper names of the pages, as added through UI.

I haven't found much about this children variable in docs. Should this still work this way in 3.6? What is the proper way to refer to child pages in template?

1
Does 1 1 0 1 correspond do how you've built your tree? If you remove those args does it show children? The children context variable is correct; docs.django-cms.org/en/release-3.6.x/topics/… - markwalker_
Yes, this corresponds to my tree. I've found that there were something wrong with language settings. - kazik

1 Answers

0
votes

I've found, that I had something wrong with language settings. Menu with subpages links started to appear after I:

Can't remember exactly which one fixed issue with submenu. Also maybe something were wrong with urls handling, I used django apps urls from urls.py instead of cms.urls.