块标记无效:'set' [英] Invalid block tag: 'set'
本文介绍了块标记无效:'set'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
无效的块标签:'set',预期'endblock'
这是我的模板:
{%block content%}
< div class =col-lg-7 col-lg-偏移2\" >
< div style =padding-top:100px>< / div>
< div class =panel panel-primary>
< div class =panel-heading>
< h3 class =panel-title>
< i class =mdi-social-person>< / i>
报告
< / h3>
< / div>
< div class =panel-body>
{%set index ='a'%}
< / div>
< / div>
< / div>
{%endblock content%}
我以为设置应该是挺直的,这不是很困难。
解决方案
set
是jinja的标签,但jinja不是Django的默认模板引擎作为@Jharris和@Gocht在评论中提到。所以,我需要先安装jinja以使用设置
标签。
I am trying to set a variable in Jinja template. Just as simple as that. But I got error says : Invalid block tag: 'set', expected 'endblock'
Here is my template:
{% block content %}
<div class="col-lg-7 col-lg-offset-2">
<div style="padding-top:100px"></div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
<i class="mdi-social-person"></i>
Reports
</h3>
</div>
<div class="panel-body">
{% set index = 'a' %}
</div>
</div>
</div>
{% endblock content %}
I thought set should be straight forward not this difficult.
解决方案
set
is jinja's tag, but jinja is not Django's default templating engine as @Jharris and @Gocht mentioned in the comment. So, I need to install jinja first to use set
tag.
这篇关于块标记无效:'set'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文