Author: gwilson
Date: 2007-11-03 21:48:44 -0500 (Sat, 03 Nov 2007)
New Revision: 6648
Modified:
django/trunk/docs/templates.txt
Log:
Added pretty tables for `floatformat` documentation.
Modified: django/trunk/docs/templates.txt
===================================================================
--- django/trunk/docs/templates.txt 2007-11-04 02:32:02 UTC (rev 6647)
+++ django/trunk/docs/templates.txt 2007-11-04 02:48:44 UTC (rev 6648)
@@ -1106,25 +1106,39 @@
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``
+======== ======================= ======
+value Template Output
+======== ======================= ======
+34.23234 {{ value|floatformat }} 34.2
+34.00000 {{ value|floatformat }} 34
+34.26000 {{ value|floatformat }} 34.3
+======== ======================= ======
-If used with a numeric integer argument, ``floatformat`` rounds a number to
that
-many decimal places. For example:
+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``
+======== ========================= ======
+value Template Output
+======== ========================= ======
+34.23234 {{ value|floatformat:3 }} 34.232
+34.00000 {{ value|floatformat:3 }} 34.000
+34.26000 {{ value|floatformat:3 }} 34.260
+======== ========================= ======
-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:
+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``
+======== ============================ ======
+value Template Output
+======== ============================ ======
+34.23234 {{ value|floatformat:"-3" }} 34.232
+34.00000 {{ value|floatformat:"-3" }} 34
+34.26000 {{ value|floatformat:"-3" }} 34.260
+======== ============================ ======
-Using ``floatformat`` with no argument is equivalent to using ``floatformat``
with
-an argument of ``-1``.
+Using ``floatformat`` with no argument is equivalent to using ``floatformat``
+with an argument of ``-1``.
get_digit
~~~~~~~~~
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---