首页 > 解决方案 > 我对 django-mptt 有问题。我是第一次使用 django-mptt,但出现以下错误

问题描述

我第一次使用 django-mptt,我有以下错误。

VariableDoesNotExist at /about
Failed lookup for key [category] in [{'True': True, 'False': False, 'None': None}, {}, {}, 
{'setting': <Setting: Techno Store>}]

这是我尝试从一个索引页移动到另一个索引页时发生的错误

错误的出现

我的代码在这里:

<nav class="category-menu category-style-2">
                                {% load mptt_tags %}
                                    <ul>
                                    {% recursetree category %}
                                        <li {% if not node.is_leaf_node %}class="menu-item-has-children"{% endif %}><a href="{% url 'category_products' node.id node.slug %}">{{ node.title }}</a>
                                            <!-- Mega Category Menu Start -->
                                            {% if not node.is_leaf_node %}
                                             <ul class="category-mega-menu"> 
                                                <li class="menu-item-has-children">
                                                    <ul>
                                                        <li><a href="#">{{ children }}</a></li>
                                                    </ul>
                                                </li> 
                                            </ul><!-- Mega Category Menu End -->
                                            {% endif %}
                                        </li>
                                    {% endrecursetree %}
                                    </ul>
                                </nav>

标签: pythondjango-templatesbackenddjango-mptt

解决方案


推荐阅读