3
在我的base.html中,我有{% include 'footer.html' %}
,並且我將base.html擴展到了我的每個頁面。但對於一些頁面,我不希望頁腳在那裏。是否可以使用某個塊關鍵字排除該頁腳?是否可以排除base.html中包含的footer.html當我擴展base.html/django
在我的base.html中,我有{% include 'footer.html' %}
,並且我將base.html擴展到了我的每個頁面。但對於一些頁面,我不希望頁腳在那裏。是否可以使用某個塊關鍵字排除該頁腳?是否可以排除base.html中包含的footer.html當我擴展base.html/django
你可以在使用block
您base.html
:
# base.html
...
{% block footer %}
{% include 'footer.html' %}
{% endblock %}
,然後在模板,你不想頁腳,這樣做:
# Some template
{% block footer %}
{% endblock %}