0
Good morning, everyone,
I’m having a basic problem but apparently boring to solve:
{% load l10n %}
{% localize off %}
var dados_grafico = [
[
'Entradas',
{{relatorio.grafico.entradas|floatformat:2}},
{{relatorio.grafico.saidas|floatformat:2}},
]
]
{% endlocalize %}
From Django’s documentation, assuming I have 10 for inputs and 7 for outputs, this should return 10.00 and 7.00 respectively, with dots separating the decimal places, which is what I desire.
The problem is it’s returning 10.00 and 7.00 (commas separating the decimal places).
I also noticed that by removing the floatformat:2 of the values, Django returns, for example, 10,000 and 7,000 (works but does not limit the number of decimals).
Question: Someone’s been through it and can give me a light?
So... Only in this case I would have to treat all the other numbers in my project so that they appear with the comma as the separator character of the decimal places. My intention was to make only this data set have this configuration, you understand?
– illozzaM
@illozzaM I don’t understand. If you change your Settings, your whole project will work according to the new configuration, qq way, I added an option in the reply, by another Lada, if it is for a specific case, it would not be easier to convert to string in the format you want, in the back-end and send already formatted to the template?
– Sidon
Exactly, Sidon! I did something similar by converting via Javascript in my template. Thank you! :)
– illozzaM