使用django-mppt
我想瀏覽我的類別層次結構,顯示與任何孩子中的當前類別相關的對象數量。recoursetree的累計數量?
就像例所示drill_down_for_node
,但只有與當前節點兒童...
最佳是
{% recursetree obj.get_children cumulative count model.Foreignkey.category in o_count%}
<li>
<h2><a href="{{ node.get_absolute_url }}">{{ node }}</a></h2>
{% if not node.is_leaf_node %}
<ul class="children">
<a href="{{ children.get_absolute_url }}">{{ children }} ({{o_count}})</a>
</ul>
{% endif %}
</li>
{% endrecursetree %}
任何指針?
不遍歷'get_children'和他們中的每一個調用模板標籤幫幫我? –
我想要一個與兒童相關的對象的累計數量,如「所有後代類別中的總數項目」... – tutuca
您是否曾經爲此找到過解決方案? – sunn0