Saludos Norma.
-- Yo hice un paquete con las funciones que uso normalmente en el día a día. Puedes encontrarla aquí: https://github.com/vellonce/python_recipes
De allí la función que te puede servir, es "moneyfmt" que es una función que le pasas un valor numérico y te regresa un string con el formato que tu le especifiques, por ejemplo.
>>> d = decimal.Decimal('-1234567.8901')>>> moneyfmt(d, curr='$')'-$1,234,567.89'>>> moneyfmt(d, places=0, sep='.', dp='', neg='', trailneg='-')'1.234.568-'>>> moneyfmt(d, curr='$', neg='(', trailneg=')')'($1,234,567.89)'>>> moneyfmt(decimal.Decimal(123456789), sep=' ')'123 456 789.00'>>> moneyfmt(decimal.Decimal('-0.02'), neg='<', trailneg='>')'<0.02>'
Espero que te sirva. Happy coding!
On Wednesday, April 2, 2014 8:51:03 PM UTC-6, Norma Bizzozzero wrote:
On Wednesday, April 2, 2014 8:51:03 PM UTC-6, Norma Bizzozzero wrote:
Me gustaría si pudieran ayudarme, quiero que al cargar en el dato identifique los valores y agregue el punto de miles.habia leido que en el settings agregueUSE_L10N = TrueUSE_THOUSAND_SEPARATOR = TrueTHOUSAND_SEPARATOR = '.'DECIMAL_SEPARATOR = ','y en el template, pero el problema es que no funciona, soy nueva utilizando python y django, agradecería cualquier ayuda.{% load l10n %} {{ value|localize }}
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8a55dd06-b31c-4104-90ba-4ad420913cdf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment