我在尝试使用| intcomma格式化数字时遇到问题。
假设我将值a和b相乘,通过使用:
<h2>{% widthratio item.a 1 item.b %}</h2>
所有的例子都使用只有一个值的intcomma:
<h2>{{ item.a|intcomma }}</h2>
以下示例不起作用:
<h2>{% widthratio value|intcomma 1 value|intcomma %}
widthratio 接受论据 as <variable> ,它将计算结果存储在变量中,然后可以在模板中使用该变量
widthratio
as <variable>
{% widthratio item.a 1 item.b as foo %} <h2>{{ foo|intcomma }}</h2>