Django mptt, extends “base.html”
问题 In base.html: <div id="menu_shop"> <input name="search" placeholder="search"> <p>Category:</p> {% 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> </div> in views: def show_category_tree(request): return render_to_response("base.html", {'nodes': Category.tree.all()}, context_instance=RequestContext(request)) urls.py: url(r'^category/', 'item