| 57 | | If called without an argument, displays a floating point |
|---|
| 58 | | number as 34.2 -- but only if there's a point to be displayed. |
|---|
| 59 | | With a positive numeric argument, it displays that many decimal places |
|---|
| 60 | | always. |
|---|
| 61 | | With a negative numeric argument, it will display that many decimal |
|---|
| 62 | | places -- but only if there's places to be displayed. |
|---|
| 63 | | Examples: |
|---|
| | 57 | Displays a float to a specified number of decimal places. |
|---|
| | 58 | |
|---|
| | 59 | If called without an argument, it displays the floating point number with |
|---|
| | 60 | one decimal place -- but only if there's a decimal place to be displayed: |
|---|
| 67 | | * num1|floatformat results in 34.2 |
|---|
| 68 | | * num2|floatformat is 34 |
|---|
| 69 | | * num1|floatformat:3 is 34.232 |
|---|
| 70 | | * num2|floatformat:3 is 34.000 |
|---|
| 71 | | * num1|floatformat:-3 is 34.232 |
|---|
| 72 | | * num2|floatformat:-3 is 34 |
|---|
| | 64 | * num3 = 34.26000 |
|---|
| | 65 | * {{ num1|floatformat }} displays "34.2" |
|---|
| | 66 | * {{ num2|floatformat }} displays "34" |
|---|
| | 67 | * {{ num3|floatformat }} displays "34.3" |
|---|
| | 68 | |
|---|
| | 69 | If arg is positive, it will always display exactly arg number of decimal |
|---|
| | 70 | places: |
|---|
| | 71 | |
|---|
| | 72 | * {{ num1|floatformat:3 }} displays "34.232" |
|---|
| | 73 | * {{ num2|floatformat:3 }} displays "34.000" |
|---|
| | 74 | * {{ num3|floatformat:3 }} displays "34.260" |
|---|
| | 75 | |
|---|
| | 76 | If arg is negative, it will display arg number of decimal places -- but |
|---|
| | 77 | only if there are places to be displayed: |
|---|
| | 78 | |
|---|
| | 79 | * {{ num1|floatformat:"-3" }} displays "34.232" |
|---|
| | 80 | * {{ num2|floatformat:"-3" }} displays "34" |
|---|
| | 81 | * {{ num3|floatformat:"-3" }} displays "34.260" |
|---|