1 2 3 4 5 6 7 8 9 | from django import template import locale locale.setlocale(locale.LC_ALL, '') register = template.Library() @register.filter() def currency(value): return locale.currency(value, grouping=True) |
1 2 3 4 5 6 7 8 9 | from django import template import locale locale.setlocale(locale.LC_ALL, '') register = template.Library() @register.filter() def currency(value): return locale.currency(value, grouping=True) |
Comments
Cool, I didn't know about the locale module. I had to change line 3 to "locale.setlocale(locale.LC_ALL, 'en_US')" for this to work on a shared server I use.
#
This works great on my ubuntu-hardy laptop but I can't get it to work on my ubuntu-gutsy server.
I get some kind of a Locale C error.
#
FIGURED IT OUT!!!
I had to set up the language pack on my ubuntu-server... Apparently this doesn't get done by default on the server version of ubuntu.
sudo ./install-language-pack en_US then restart x and you're golden.
#