Force Django to use a period for specific decimals
The best way that does is casting the number to a string before I send it to the template, which works perfectly every time.

I'd like to know if there's a better way to do it.

Nope.
I've got an issue with the Django template localisation. In the German locale, it forces decimals to use a comma as the separator, which is fine for display. However I also need to modify some JS tracking to send a price to the reporting engine.
Django is also localising that value (It's inline with the HTML, bad I know, but I didn't write it & I can't change that right now)
Is there any way to force the template to use the period for that particular number? I've tried:
{{ price|floatformat:2 }}
but that doesn't work.
The only way that does is casting the number to a string before I send it to the template, which works well enough but I'd like to know if there's a better way to do it.