How to print number with commas as thousands separator and decimal places in Python/Django
I'm trying to display numbers in my Django templates with
- commas as thousand sepaerator and
- specifying the decimal places to round to.
e.g. 76384.8739439 -> 76,384.87
Django has template tags to achieve both these.
- intcomma - for thousand separator and
- floatformat - for decimal places
I can't seem to find a way to do both at the same time without writing m开发者_开发问答y own custom template filter. Anybody know of an easier solution?
{{ value|floatformat:2|intcomma }}
精彩评论