私はDjango Wagtailメニューにhttps://github.com/rkhleics/wagtailmenusを使用していますが、flat_menu
のカスタムテンプレートの使い方を理解できないようです。私はガイドに従ったが、私は何かが間違っているかもしれないと思う。カスタムDjango Wagtailmenusフラットメニューテンプレート
私のflat_menuテンプレートは、ディレクトリmenus/top_sub_menu.html
にあります。ここで、top_sub_menu
は作成したメニューのハンドルです。
top_sub_menu.html
{% load menu_tags %}
{% if menu_items %}
<ul class="c-links c-theme-ul">
{% for item in menu_items %}
<li>
<a href="{{ item.href }}">{{ item.text }}</a> {% if item.has_children_in_menu %}{% sub_menu item %}{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
header.html
{% load menu_tags %}
...
{% flat_menu 'top_sub_menu' %}
...
私は、カスタムmain_menu.html
と同じディレクトリにsub_menu.html
を持っており、彼らが働くので、私は私のメニューのディレクトリを知っています正しい場所にあります。ありがとうございました。