如何将筛选器放入另一个筛选器中。我已经在blog_extras.py
中创建了一个名为“titl”的筛选器:
@register.filter(is_safe=True)
def titl(texte):
return " %s " % texte.title()
我在模板中加载:
{% load blog_extras %}
然后我这样做:
{%for categorie in Categories%}
<a href="#"><div class="categorie">
<center><h1 class="c">{{ {{categorie}} |titl }}</h1></center>
</div></a>
{% empty %}
<h1>Le blog est en construction</h1>
{%endfor%}
但出现一条错误消息:
TemplateSyntaxError at /blog/menu/ Could not parse the remainder: '{{categorie' from '{{categorie'
你的牙套太多了。应该是的
而不是
{{ {{categorie}} | titl }}
相关问题 更多 >
编程相关推荐