Django Humanize Filters

A snippet showing how to use humanize in templates.


# settings.py
INSTALLED_APPS += ['django.contrib.humanize']

# template.html
{% load humanize %}
<p>{{ 1200000|intcomma }}</p>
<p>{{ 3|apnumber }} apples</p>
<p>{{ ts|naturaltime }}</p>
  
Explanation:
  • Enable django.contrib.humanize in INSTALLED_APPS.
  • Load with {% load humanize %} to use filters like intcomma and naturaltime.
Never miss a story on Django.wiki

Subscribe for fresh tutorials, snippets, and updates.

By subscribing you agree to our Privacy Policy.