diff options
| author | Daniel Greenfeld <pydanny@gmail.com> | 2012-11-04 16:35:40 -0800 |
|---|---|---|
| committer | Daniel Greenfeld <pydanny@gmail.com> | 2012-11-04 16:35:40 -0800 |
| commit | d5c3c45f2fdfee09d81ad8dc7b0db8338d6d0aae (patch) | |
| tree | 4ebc93937dd9a3494fc82a845bb251ed042c4ea5 /docs/ref | |
| parent | 8d3f932f18c75fcbb32cf3dd5998445d65b5db0f (diff) | |
Demonstrate how to round to integers using floatformat templatetag
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/templates/builtins.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 4aa1a990cd..175e9dfd5d 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -1517,6 +1517,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``. |
