Hi @Joselito,
Thanks for being a part of our community! In django templates, the floatformat
filter is used to control the number of decimal places displayed. floatformat
will round the number to the specified decimal places, and it will only display decimal places if they are non-zero.
To round a decimal number but display it as an integer if it ends in .00
, you would use floatformat
with a negative value. For example:
{{ value|floatformat:"-2" }}
. This will round the number to two decimal places. However, if the number ends in .00
, it will be displayed as an integer without any decimal places. I hope this helps!
~Chloe