settings: add django.contrib.humanize templatetags (#46337)

This commit is contained in:
Thomas NOËL 2020-09-04 10:40:52 +02:00
parent fe9a744119
commit a94f09121a
2 changed files with 10 additions and 0 deletions

View File

@ -119,6 +119,7 @@ TEMPLATES = [
],
'builtins': [
'combo.public.templatetags.combo',
'django.contrib.humanize.templatetags.humanize',
],
},
},

View File

@ -799,3 +799,12 @@ def test_phonenumber_fr():
assert t.render(Context({'number': None})) == 'None'
t = Template('{{ number|decimal|phonenumber_fr }}')
assert t.render(Context({'number': '1,33'})) == '1.33'
def test_django_contrib_humanize_filters():
tmpl = Template('{{ foo|intcomma }}')
assert tmpl.render(Context({'foo': 10000})) == '10,000'
assert tmpl.render(Context({'foo': '10000'})) == '10,000'
with override_settings(LANGUAGE_CODE='fr-fr'):
assert tmpl.render(Context({'foo': 10000})) == '10 000'
assert tmpl.render(Context({'foo': '10000'})) == '10 000'