summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2007-01-03 05:29:34 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2007-01-03 05:29:34 +0000
commitc3f891210a05a9593e3df4cb04dfda7442af2065 (patch)
tree82b7f71f2b66189ef7141387faa8aeed75101cbc /docs
parent9e0c5d1ecdd5b57b8e044230b09d7903835e6116 (diff)
Fixes #3176, #3004 -- Added an argument to the floatfilter to allow users to specify precision of floats, Thanks, Eric Floehr.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4274 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/templates.txt22
1 files changed, 20 insertions, 2 deletions
diff --git a/docs/templates.txt b/docs/templates.txt
index b4cc47b9f3..d0cd69f1d2 100644
--- a/docs/templates.txt
+++ b/docs/templates.txt
@@ -924,13 +924,31 @@ Replaces ampersands with ``&amp;`` entities.
floatformat
~~~~~~~~~~~
-Rounds a floating-point number to one decimal place -- but only if there's a
-decimal part to be displayed. For example:
+When used without an argument, rounds a floating-point number to one decimal
+place -- but only if there's a decimal part to be displayed. For example:
* ``36.123`` gets converted to ``36.1``
* ``36.15`` gets converted to ``36.2``
* ``36`` gets converted to ``36``
+**New in Django development version**
+
+If used with a numeric integer argument, ``floatformat`` rounds a number to that
+many decimal places. For example:
+
+ * ``36.1234`` with floatformat:3 gets converted to ``36.123``
+ * ``36`` with floatformat:4 gets converted to ``36.0000``
+
+If the argument passed to ``floatformat`` is negative, it will round a number to
+that many decimal places -- but only if there's a decimal part to be displayed.
+For example:
+
+ * ``36.1234`` with floatformat:-3 gets converted to ``36.123``
+ * ``36`` with floatformat:-4 gets converted to ``36``
+
+Using ``floatformat`` with no argument is equivalent to using ``floatformat`` with
+an argument of ``-1``.
+
get_digit
~~~~~~~~~