diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-06-04 00:58:39 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-06-04 00:58:39 +0000 |
| commit | fb537e177d7d304d6642ee6005258a82584a8032 (patch) | |
| tree | 3c5a1d65f3a8b6918b8e5597067a1cd6a56361e7 /docs/add_ons.txt | |
| parent | a5b7c298164e3c1547988c734d6155c17f57b1d7 (diff) | |
Added django.contrib.humanize, a set of template tags for adding a 'human touch' to data. They're documented in add_ons.txt.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/add_ons.txt')
| -rw-r--r-- | docs/add_ons.txt | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/docs/add_ons.txt b/docs/add_ons.txt index f7b3056ef0..bcc2f50a7f 100644 --- a/docs/add_ons.txt +++ b/docs/add_ons.txt @@ -45,6 +45,57 @@ See the `csrf documentation`_. .. _csrf documentation: http://www.djangoproject.com/documentation/csrf/ +humanize +======== + +A set of Django template filters useful for adding a "human touch" to data. +To activate these filters, add ``'django.contrib.english'`` to your +``INSTALLED_APPS`` setting. Once you've done that, use ``{% load english %}`` +in a template, and you'll have access to these filters: + +ordinal +------- + +Converts an integer to its ordinal as a string. + +Examples: + + * ``1`` becomes ``'1st'``. + * ``2`` becomes ``'2nd'``. + * ``3`` becomes ``'3rd'``. + +You can pass in either an integer or a string representation of an integer. + +intcomma +-------- + +Converts an integer to a string containing commas every three digits. + +Examples: + + * ``4500`` becomes ``'4,500'``. + * ``45000`` becomes ``'45,000'``. + * ``450000`` becomes ``'450,000'``. + * ``4500000`` becomes ``'4,500,000'``. + +You can pass in either an integer or a string representation of an integer. + +intword +------- + +Converts a large integer to a friendly text representation. Works best for +numbers over 1 million. + +Examples: + + * ``1000000`` becomes ``'1.0 million'``. + * ``1200000`` becomes ``'1.2 million'``. + * ``1200000000`` becomes ``'1.2 billion'``. + +Values up to 1000000000000000 (one quadrillion) are supported. + +You can pass in either an integer or a string representation of an integer. + flatpages ========= |
