我使用django模板中的嵌套for循环打印从数据库中获取的数据
{% if objectives %}
{% for obj in objectives %}
{% for sobj in sobjective %}
{% if sobj.id==obj.id %} yes {% endif %}
所有打开的标签都已关闭
但这是一个错误 正如我上面提到的
TemplateSyntaxError at /objectives
Could not parse the remainder: '==obj.id' from 'sobj.id==obj.id'
Django模板语言需要在
==
运算符周围使用空格,因此您应该将其实现为:在Python中,{}是有效的,但Django的模板语言有特定的标记和语法
相关问题 更多 >
编程相关推荐