为什么我不能在 if 标记内嵌套块标记? [英] Why can't I nest a block tag inside an if tag?
本文介绍了为什么我不能在 if 标记内嵌套块标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为 base.html
的主模板文件,其中包含以下代码:
I have a master template file called base.html
, in it I have the following code:
{% ifequal environment "dev" %}
{% block stylesheets %}{% endblock %}
{% endifequal %}
我在其他模板中继承它并执行以下操作:
I inherit this in other templates and do the following:
{% block stylesheets %}
<link ... >
{% endblock %}
问题是,我链接的样式表永远不会被应用,样式表块似乎被忽略是否在基础中满足 ifequal 条件.
The problem is, the stylesheet I link never gets applied, the stylesheets block seems to be ignored whether the ifequal condition is met in the base or not.
推荐答案
这个问题不再相关 - 截至 r12655 你可以在条件中嵌套一个块标签.
This question is no longer relevant - as of r12655 you can nest a block tag within a conditional.
这篇关于为什么我不能在 if 标记内嵌套块标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文