how to turn off l10N for django-money values

Viewed 62

I use {% load l10n %} and it works great.

But it formats Money('55652.69924091', 'USD') (from the package django-money) into 55652.70 USD, which is generally ok, but in one place i need to get 55652.6992 USD (decimal places increase to 4).

I tried {% localize off %}{{ object.value }} {% endlocalize %} but no effect.

I can do it with .amount, but this is ugly.

1 Answers

From django-money's documentation on Format Localization it has a template tag called as money_localize which you can use to turn localization on / off for specific values. Hence you can write:

{% load djmoney %}
...
{% money_localize object.value off %}
Related