The floatformat
filter takes an n
argument for the number of decimal places to round to. Without that argument, it will round to one decimal place unless the decimal value is 0
, in which case it will just output the integer.
filter | 1000.0 | 1000.11 | 3.14159 |
---|---|---|---|
{{ i|floatformat }} |
1000 | 1000.1 | 3.1 |
{{ i|floatformat:2 }} |
1000.00 | 1000.11 | 3.14 |
{{ i|floatformat:0 }} |
1000 | 1000 | 3 |