[Answered ]-How do I configure django-money to output GBP in British format?

2👍

Django-money uses pymoneyed for handling localization, but unfortunately at the time of writing, pymoneyed isn’t set up properly to handle GBP localization. I’ve created a pull request which fixes it so hopefully this will be fixed at some point.

In the meantime, you can configure your Django installation to handle it correctly by adding the following code anywhere that will get called when Django is run (such as in a models.py).

import moneyed
from moneyed.localization import _FORMATTER
from decimal import ROUND_HALF_EVEN

# A unicode GBP sign
POUND_SIGN = u'\u00A3'

_FORMATTER.add_formatting_definition("en_GB",
    group_size=3, group_separator=",", decimal_point=".",
    positive_sign="", trailing_positive_sign="",
    negative_sign="-", trailing_negative_sign="",
    rounding_method=ROUND_HALF_EVEN)
_FORMATTER.add_sign_definition('en_GB', moneyed.GBP, prefix=POUND_SIGN)

Leave a comment