{%扩展了父_ template | default:"base.html"%}与{%扩展了"base.html"%}在Django中? [英] { % extends parent _ template|default:"base.html" % } vs {% extends "base.html" %} in Django?
本文介绍了{%扩展了父_ template | default:"base.html"%}与{%扩展了"base.html"%}在Django中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Django的模板继承中,{%扩展父_模板|默认值:"base.html"%}与{%扩展"base.html"%}有什么区别?我已经看到两者都被使用了.
What is the difference between { % extends parent _ template|default:"base.html" % } vs {% extends "base.html" %} in template inheritance in django ? I've seen both being used.
推荐答案
{%如果具有
将扩展它.如果不是,它将扩展 parent_template
,则扩展parent_template | default:"base.html"%} base.html
{ % extends parent_template|default:"base.html" % }
if have parent_template
, it will extend it. If not , it will extend base.html
{%扩展"base.html"%}
始终扩展 base.html
.
不同
这篇关于{%扩展了父_ template | default:"base.html"%}与{%扩展了"base.html"%}在Django中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文