Skip to content

Commit

Permalink
use mptt's get_descendant_count for the "has children" calculatio…
Browse files Browse the repository at this point in the history
…n, which doesn't make a query
  • Loading branch information
beniwohli committed Jul 31, 2012
1 parent fda830a commit 46506b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cms/templates/admin/cms/page/lazy_child_menu.html
@@ -1,8 +1,8 @@
{% load cms_admin i18n adminmedia %}{% with page.children.exists as has_children %}<li id="page_{{page.pk}}" class="{% if cl.is_filtered %}leaf{% endif %}{% if has_move_page_permission %} moveable{% endif %}{% if has_children %} closed{% endif %}"{% if metadata %} mdata="{{ metadata }}{% endif %}" rel="{% ifequal page.level 0 %}topnode{% else %}node{% endifequal %}">
{% load cms_admin i18n adminmedia %}{% with page.get_descendant_count as has_children %}<li id="page_{{page.pk}}" class="{% if cl.is_filtered %}leaf{% endif %}{% if forloop.last %} last{% endif %}{% if has_move_page_permission %} moveable{% endif %}{% if has_children %} closed{% endif %}"{% if metadata %} mdata="{{ metadata }}{% endif %}" rel="{% ifequal page.level 0 %}topnode{% else %}node{% endifequal %}">

{% include 'admin/cms/page/menu_item.html' %}

{% if has_children %}<ul{% if page.last %} class="last"{% endif %}>
</ul>{% endif %}
</li>
{% endwith %}
{% endwith %}

0 comments on commit 46506b7

Please sign in to comment.