0
0
mirror of https://github.com/django/django.git synced 2024-12-01 07:31:48 +01:00

Merge pull request #496 from pydanny/ticket_19241

Demonstrate how to round to integers using floatformat templatetag
This commit is contained in:
Bryan Veloso 2012-11-04 18:19:56 -08:00
commit 79a484fc8e

View File

@ -1528,6 +1528,17 @@ displayed. For example:
``34.26000`` ``{{ value|floatformat:"-3" }}`` ``34.260``
============ ================================ ==========
If the argument passed to ``floatformat`` is 0 (zero), it will round the number
to the nearest integer.
============ ================================ ==========
``value`` Template Output
============ ================================ ==========
``34.23234`` ``{{ value|floatformat:"0" }}`` ``34``
``34.00000`` ``{{ value|floatformat:"0" }}`` ``34``
``39.56000`` ``{{ value|floatformat:"0" }}`` ``40``
============ ================================ ==========
Using ``floatformat`` with no argument is equivalent to using ``floatformat``
with an argument of ``-1``.