2009-11-04 26 views
1

我嘗試使用django-treemenus。 http://code.google.com/p/django-treemenus/如何使用django樹形菜單

我使用管理界面創建一個樹形菜單(和菜單項)。 當我嘗試使用show_meny標記加載菜單(下面你找到我的模板,我稱之爲標籤)。

我想我需要調用treemenus/menu.html(在示例中給出的開始),但我不知道如何? shoold我修改我的TEMPLATE_DIRS?

{% extends "polls/base.html" %} 

{% block title %}Poll list{% endblock %} 
{# we override the block content here#} 
{% block content %} 

**{% load tree_menu_tags %} 
{% show_menu "home" "vertical" %}** 


    {% if object_list %} 
     <ul> 
      {% for poll in object_list %} 
      <li>{{ poll.question }} at [ {{poll.pub_date|date:"F j, Y"}}]</li> 
      {% endfor %} 
     </ul> 
    {% else %} 
     <p>No polls are available.</p> 
    {% endif %} 
{% endblock %} 

回答

1

找到你的問題,同時尋找不同的treemenu問題的答案,我想我(只是勉強)有資格回答。

答案是否定的,你不需要修改你的TEMPLATE_DIRS。您需要在模板目錄內創建一個treemenus目錄,並在其中放置一個menu.html和menu_item.html。你會在django-treemenus發行版的docs目錄中找到這兩個例子。