1π
β
I donβt think you problem is in any way connected to using safe
. Itβs just a case of python string formating (that you use in your view) not being location-aware. You could try using locale.format() instead, which is intended as a locale-aware alternative.
But it is not a good practice to put HTML into your views anyway. So I would move formating logic to your template:
view.py
def a(request)
a=3.222
c=1.555
content={'a':b, 'c':c}
return render(request, 'a.html', context)
a.html
{% if a>5 %}
<b>{{ a }}</b>
{% else %}
{{ a }}
{% endif %}
{{ c }}
π€Ludwik Trammer
Source:stackexchange.com