On Jan 3, 5:33 am, phoebebright <phoebebri...@spamcop.net> wrote: > On Jan 2, 7:06 pm, Shay Ben Dov <shay.ben...@gmail.com> wrote: > > > Hi, > > > I'm using GAE and wondering how come there is no comma insertion > > orcurrencyformating of floating numbers like: > > > {{ value|floatformat:2 }} built_in filter > > > Shay > > You could > tryhttp://docs.djangoproject.com/en/dev/ref/templates/builtins/#floatformat > o rhttp://docs.djangoproject.com/en/dev/ref/templates/builtins/#stringfo...
If the reference to "comma insertion" is for commas as 1000s separators, we use the following addition to contrib.humanize.py: def floatcomma(value): """ Converts a float to a string containing commas every three digits. For example, 3000.65 becomes '3,000.65' and -45000.00 becomes '-45,000.00'. """ orig = force_unicode(value) intpart, dec = orig.split(".") intpart = intcomma(intpart) return ".".join([intpart, dec]) floatcomma.is_safe = True register.filter(floatcomma) This is specifically for currency output on invoices. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---