gpt4 book ai didi

html - 当我扩展 base.html/for django 时,是否可以排除 base.html 中包含的 footer.html

转载 作者:搜寻专家 更新时间:2023-10-31 22:19:10 25 4
gpt4 key购买 nike

在我的 base.html 中,我有 {% include 'footer.html' %} 并且我将 base.html 扩展到我的每个页面。但是对于某些页面,我不希望页脚在那里。是否可以使用某些 block 关键字排除该页脚?

最佳答案

您可以在 base.html 中使用 block:

# base.html
...
{% block footer %}
{% include 'footer.html' %}
{% endblock %}

然后在不需要页脚的模板中,执行以下操作:

# Some template
{% block footer %}
{% endblock %}

关于html - 当我扩展 base.html/for django 时,是否可以排除 base.html 中包含的 footer.html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35752873/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com