Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Demonstrate how to round to integers using floatformat templatetag

  • Loading branch information...
commit d5c3c45f2fdfee09d81ad8dc7b0db8338d6d0aae 1 parent 8d3f932
Daniel Greenfeld authored

Showing 1 changed file with 11 additions and 0 deletions. Show diff stats Hide diff stats

  1. 11  docs/ref/templates/builtins.txt
11  docs/ref/templates/builtins.txt
@@ -1517,6 +1517,17 @@ displayed. For example:
1517 1517
 ``34.26000``  ``{{ value|floatformat:"-3" }}``  ``34.260``
1518 1518
 ============  ================================  ==========
1519 1519
 
  1520
+If the argument passed to ``floatformat`` is 0 (zero), it will round the number
  1521
+to the nearest integer.
  1522
+
  1523
+============  ================================  ==========
  1524
+``value``     Template                          Output
  1525
+============  ================================  ==========
  1526
+``34.23234``  ``{{ value|floatformat:"0" }}``   ``34``
  1527
+``34.00000``  ``{{ value|floatformat:"0" }}``   ``34``
  1528
+``39.56000``  ``{{ value|floatformat:"0" }}``   ``40``
  1529
+============  ================================  ==========
  1530
+
1520 1531
 Using ``floatformat`` with no argument is equivalent to using ``floatformat``
1521 1532
 with an argument of ``-1``.
1522 1533
 

0 notes on commit d5c3c45

Please sign in to comment.
Something went wrong with that request. Please try again.