Quick and nasty: from django.core import template register = template.Library()
@register.filter(name='commas') def commas(value): return "".join(commafy(value)) def commafy(s): pieces = s.split(".") l = len(pieces[0]) for i in range(0,l): if (l - i) % 3 or not i: yield pieces[0][i] else: yield "," yield pieces[0][i] if len(pieces) > 1: yield "." + pieces[1] value should be a string (eg your preformatted number). obviously does not care about your locale. jtm --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---