[Answered ]-Django DecimalField "." instead of ","

2đź‘Ť

âś…

The django admin is probably behaving correctly; the problem lies with how the decimal fields are converted to strings in the template. This is probably due to internationalization. Indeed, the DECIMAL_SEPARATOR setting exists but “the locale-dictated format has higher precedence”.

I suggest you try the following in the template:

{% load l10n %}

"type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [
        {{ map.lon|unlocalize }},
        {{ map.lat|unlocalize }}
      ]
    }

The unlocalize template tag is described in the Django documentation.

👤Régis B.

Leave a comment