Reputation: 185
I am having issues trying to use |intcomma to format a number.
Let's say I multiply the values a and b which adds up to 1000000 by using:
<h2>{% widthratio item.a 1 item.b %}</h2>
All examples out there use intcomma with only one value:
<h2>{{ item.a|intcomma }}</h2>
So my question is, how do you combine widthratio with intcomma in order to get the multiplied number formatted as 1,000,000. Example below which do not work:
<h2>{% widthratio value|intcomma 1 value|intcomma %}
Upvotes: 3
Views: 871
Reputation: 32274
widthratio
accepts an argument as <variable>
, this stores the result of the calculation in a variable that can then be used in your template
{% widthratio item.a 1 item.b as foo %}
<h2>{{ foo|intcomma }}</h2>
Upvotes: 4