Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #496 from pydanny/ticket_19241

Demonstrate how to round to integers using floatformat templatetag
  • Loading branch information...
commit 79a484fc8e2f62262e91d5073282c6f0ec497b01 2 parents a70492e + d5c3c45
Bryan Veloso authored November 04, 2012

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
@@ -1528,6 +1528,17 @@ displayed. For example:
1528 1528
 ``34.26000``  ``{{ value|floatformat:"-3" }}``  ``34.260``
1529 1529
 ============  ================================  ==========
1530 1530
 
  1531
+If the argument passed to ``floatformat`` is 0 (zero), it will round the number
  1532
+to the nearest integer.
  1533
+
  1534
+============  ================================  ==========
  1535
+``value``     Template                          Output
  1536
+============  ================================  ==========
  1537
+``34.23234``  ``{{ value|floatformat:"0" }}``   ``34``
  1538
+``34.00000``  ``{{ value|floatformat:"0" }}``   ``34``
  1539
+``39.56000``  ``{{ value|floatformat:"0" }}``   ``40``
  1540
+============  ================================  ==========
  1541
+
1531 1542
 Using ``floatformat`` with no argument is equivalent to using ``floatformat``
1532 1543
 with an argument of ``-1``.
1533 1544
 

0 notes on commit 79a484f

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