wagtail-experiments icon indicating copy to clipboard operation
wagtail-experiments copied to clipboard

Floats are being formatted in a language aware manner

Open mitchellslager opened this issue 5 years ago • 0 comments

The following line of code (in report.html) does not format floats correctly in some languages: '{{ history_entry.conversion_rate|floatformat:2|escapejs }}'{% if not forloop.last %},{% endif %}

For example, in my Dutch language based Django site this will format 12.3456 as 12,35. This breaks the report graph.

I think the solution is to change that line of code to: '{{ history_entry.conversion_rate|stringformat:".2f"|escapejs }}'{% if not forloop.last %},{% endif %}

mitchellslager avatar Aug 10 '20 11:08 mitchellslager