Tuesday, October 27, 2015

IntComma without RequestContext

I am feeling a little lost, a project that I have used intcomma in reliably on an update suddenly stopped getting the commas inserted. This is for an out of request cycle email.

Attempting activate the language doesn't seem to change anything. Am I missing something simple here?

>>> from django.contrib.humanize.templatetags.humanize import intcomma
>>> intcomma(1000)
u'1000'
>>> intcomma("1000", use_l10n=False) #not sure how to do this in templates
u'1,000'
>>> from django.utils.translation import activate, get_language
>>> get_language()
u'us-en'
>>> activate("us-en")
>>> intcomma("1000")
u'1000'

--
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/30892a71-1a41-488e-b9f9-3d71cfc6abcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment