在我的base.html中,我有{% include 'footer.html' %}
,我将base.html扩展到我的每个页面。但对于某些页面,我不想让页脚在那里。是否可以使用某个块关键字排除该页脚?
答案 0 :(得分:8)
您可以在block
中使用base.html
:
# base.html
...
{% block footer %}
{% include 'footer.html' %}
{% endblock %}
然后在你不想要页脚的模板中,执行以下操作:
# Some template
{% block footer %}
{% endblock %}