Django

Code

Changeset 6648

Show
Ignore:
Timestamp:
11/03/07 21:48:44 (1 year ago)
Author:
gwilson
Message:

Added pretty tables for floatformat documentation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/templates.txt

    r6640 r6648  
    11071107place -- but only if there's a decimal part to be displayed. For example: 
    11081108 
    1109     * ``36.123`` gets converted to ``36.1`` 
    1110     * ``36.15`` gets converted to ``36.2`` 
    1111     * ``36`` gets converted to ``36`` 
    1112  
    1113 If used with a numeric integer argument, ``floatformat`` rounds a number to that 
    1114 many decimal places.  For example: 
    1115  
    1116     * ``36.1234`` with floatformat:3 gets converted to ``36.123`` 
    1117     * ``36`` with floatformat:4 gets converted to ``36.0000`` 
    1118  
    1119 If the argument passed to ``floatformat`` is negative, it will round a number to 
    1120 that many decimal places -- but only if there's a decimal part to be displayed. 
    1121 For example: 
    1122  
    1123     * ``36.1234`` with floatformat:-3 gets converted to ``36.123`` 
    1124     * ``36`` with floatformat:-4 gets converted to ``36`` 
    1125  
    1126 Using ``floatformat`` with no argument is equivalent to using ``floatformat`` with 
    1127 an argument of ``-1``. 
     1109========  =======================  ====== 
     1110value     Template                 Output 
     1111========  =======================  ====== 
     111234.23234  {{ value|floatformat }}  34.2 
     111334.00000  {{ value|floatformat }}  34 
     111434.26000  {{ value|floatformat }}  34.3 
     1115========  =======================  ====== 
     1116 
     1117If used with a numeric integer argument, ``floatformat`` rounds a number to 
     1118that many decimal places.  For example: 
     1119 
     1120========  =========================  ====== 
     1121value     Template                   Output 
     1122========  =========================  ====== 
     112334.23234  {{ value|floatformat:3 }}  34.232 
     112434.00000  {{ value|floatformat:3 }}  34.000 
     112534.26000  {{ value|floatformat:3 }}  34.260 
     1126========  =========================  ====== 
     1127 
     1128If the argument passed to ``floatformat`` is negative, it will round a number 
     1129to that many decimal places -- but only if there's a decimal part to be 
     1130displayed. For example: 
     1131 
     1132========  ============================  ====== 
     1133value     Template                      Output 
     1134========  ============================  ====== 
     113534.23234  {{ value|floatformat:"-3" }}  34.232 
     113634.00000  {{ value|floatformat:"-3" }}  34 
     113734.26000  {{ value|floatformat:"-3" }}  34.260 
     1138========  ============================  ====== 
     1139 
     1140Using ``floatformat`` with no argument is equivalent to using ``floatformat`` 
     1141with an argument of ``-1``. 
    11281142 
    11291143get_digit