我想在Django模板中声明一个变量并将其增加一个。你知道吗
我的密码是
{% with 0 as my_variable %}
{% for address in user.addresses %}
{{my_variable=my_variable+1}}
{% if my_variable==1 %}
// do something
{% else %}
// do something
{% endif %}
{% endfor %}
{% endwith %}
它给出了
jinja2.exceptions.TemplateSyntaxError: can't assign to 'const'
如何声明变量并增加它?你知道吗
What you want is
也要记住
以及
相关问题 更多 >
编程相关推荐