Requires {% load humanize %}
Add {% load humanize %} near the top of any template that
uses |ordinal. Without it Django does not
know the name and raises TemplateSyntaxError.
{% load humanize %} only works when
"django.contrib.humanize" is in your
INSTALLED_APPS — the load fails before the
library is ever reached.
Converts an integer to its ordinal string — the form you would say out loud.
Template
{% load humanize %}
<p>You finished {{ place|ordinal }}</p>
Result
<p>You finished 3rd</p>
It knows the awkward ones: 1st, 2nd, 3rd, but 11th, 12th, and 13th.
