A set of Django template filters useful for adding a “human touch” to data.
To activate these filters, add 'django.contrib.humanize' to your INSTALLED_APPS setting. Once you’ve done that, use {% load humanize %} in a template, and you’ll have access to these filters:
For numbers 1-9, returns the number spelled out. Otherwise, returns the number. This follows Associated Press style.
Examples:
You can pass in either an integer or a string representation of an integer.
Converts an integer to a string containing commas every three digits.
Examples:
You can pass in either an integer or a string representation of an integer.
Converts a large integer to a friendly text representation. Works best for numbers over 1 million.
Examples:
Values up to 1000000000000000 (one quadrillion) are supported.
You can pass in either an integer or a string representation of an integer.
Converts an integer to its ordinal as a string.
Examples:
You can pass in either an integer or a string representation of an integer.
For dates that are the current day or within one day, return “today”, “tomorrow” or “yesterday”, as appropriate. Otherwise, format the date using the passed in format string.
Argument: Date formatting string as described in the now tag.
Examples (when ‘today’ is 17 Feb 2007):
Sep 20, 2009