Add filter for formatting dollar values
This commit is contained in:
@@ -3,5 +3,14 @@ def iconSvg(name):
|
||||
return contents.read()
|
||||
|
||||
|
||||
def dollars(value):
|
||||
try:
|
||||
numberValue = float(value)
|
||||
except ValueError:
|
||||
numberValue = 0
|
||||
return "${:,.0f}".format(numberValue)
|
||||
|
||||
|
||||
def register_filters(app):
|
||||
app.jinja_env.filters['iconSvg'] = iconSvg
|
||||
app.jinja_env.filters['dollars'] = dollars
|
||||
|
Reference in New Issue
Block a user