Python Django mptt未在模板中列出名称

Python Django mptt未在模板中列出名称,python,python-3.x,django,django-views,django-templates,Python,Python 3.x,Django,Django Views,Django Templates,我正在使用django mptt库构建一个类别树。当我把下面的代码放在我的模板中时,我得到了这个错误 index.html {% load mptt_tags %}{% load mptt_tags %} <ul class="root"> {% recursetree nodes %} <li> {{ node.name }} {% if not node.is_leaf_nod

我正在使用django mptt库构建一个类别树。当我把下面的代码放在我的模板中时,我得到了这个错误

index.html

{% load mptt_tags %}{% load mptt_tags %}
<ul class="root">
    {% recursetree nodes %}
        <li>
            {{ node.name }}
            {% if not node.is_leaf_node %}
                <ul class="children">
                    {{ children }}
                </ul>
            {% endif %}
        </li>
    {% endrecursetree %}
</ul>

模板变量的名称是
列表
,而不是
节点

{% load mptt_tags %}
<ul class="root">
    {% recursetree listing %}
        …
    {% endrecursetree %}
</ul>
{%loadmptt\u标签%}
    {%recursetree清单%} … {%endrecursetree%}
非常感谢@willem Van Onsem
context={
    'listing':listing
}
return render(request,'catalog/index.html',context)
{% load mptt_tags %}
<ul class="root">
    {% recursetree listing %}
        …
    {% endrecursetree %}
</ul>