I am trying to format a string in a template to display as a currency. {{ object.cost }}
Would I be able to do something like "${:,.2f}".format({{ object.cost }})
in the template?
CodePudding user response:
You can try to use floatformat filter:
{{ object.cost|floatformat:2 }}
where 2 means two decimals.