1 2 3 4 5 6 | @register.filter
def dollarize(c):
if c>0:
return "$%s"%c
else:
return "-$%s"%(-1*c)
|
More like this
- captcha, verification code by dingdongquan 1 year, 4 months ago
- restrict user access to modeladmin via metaclass by code_shogan 1 year, 3 months ago
- Significant digits filter by joelegner 3 years, 2 months ago
- Template Tag for Retrieving Settings by joshua 5 years, 2 months ago
- Humanize lists of strings in templates by ChipX86 4 years, 11 months ago
Comments
Unless I did something wrong, it didn't return two decimal places for integers and single point precision numbers. This did the trick:
#