【问题标题】:can we extend more than one html in single html template in django?and if yes then how?我们可以在 django 的单个 html 模板中扩展多个 html 吗?如果可以,那么如何?
【发布时间】:2016-12-24 01:11:16
【问题描述】:

我有两个文件...一个是 base.html 另一个是 home.html

我想在 django 的单个 index.html 模板上扩展它们。

但它在 /accounts/login/ 处抛出错误 TemplateSyntaxError “扩展”不能在同一模板中出现多次在浏览器中

【问题讨论】:

  • 请参阅“'extends'不能在浏览器的同一模板中出现多次”

标签: django django-templates


【解决方案1】:

您可以在 index.html 中扩展 base 并使用:

{% include "path/to/home.html" %}  

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-10
    • 2020-05-11
    • 2023-01-13
    • 2017-10-04
    • 2021-05-08
    • 2018-11-05
    • 1970-01-01
    • 2018-06-23
    相关资源
    最近更新 更多