【问题标题】:is it possible to exclude footer.html which is included in base.html when I extend base.html/for django当我扩展 base.html/for django 时,是否可以排除 base.html 中包含的 footer.html
【发布时间】:2016-03-02 16:27:15
【问题描述】:

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

【问题讨论】:

    标签: html django


    【解决方案1】:

    您可以在base.html 中使用block

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

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

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

    【讨论】:

      猜你喜欢
      • 2012-09-27
      • 1970-01-01
      • 2021-02-05
      • 2018-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-15
      相关资源
      最近更新 更多