Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support decimal places #114

Closed
wants to merge 4 commits into from

Conversation

neoecos
Copy link

@neoecos neoecos commented Feb 1, 2019

@spookylukey I added decimal_placesto the Currency class, with the intention to use the currency decimal places as default parameter in the formatting.

Also added the decimal places to all currencies supported, and corresponding tests.

@spookylukey
Copy link
Collaborator

@neoecos - thanks so much for this patch and the effort you have put into it.

Unfortunately, we already made a decision that all formatting of currencies is now going to go through Babel - we are waiting for a patch for this - #22 (comment)

With that patch in place, this patch would become redundant - format.numbers.format_currency already has knowledge of decimal places built in:

>>> format_currency(1, 'USD')
'US$1.00'

>>> format_currency(1, 'BHD')
'BHD1.000'

and it has support for more customization with other options - http://babel.pocoo.org/en/latest/api/numbers.html#babel.numbers.format_currency

If you would like to have a go at implementing the patch as described in the other ticket, it would be very much appreciated! Sorry for wasted effort, but using Babel is going to give us many improvements long term.

@spookylukey spookylukey closed this Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants