Django

Code

Changeset 3076

Show
Ignore:
Timestamp:
06/03/06 19:58:39 (3 years ago)
Author:
adrian
Message:

Added django.contrib.humanize, a set of template tags for adding a 'human touch' to data. They're documented in add_ons.txt.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/add_ons.txt

    r2958 r3076  
    4545 
    4646.. _csrf documentation: http://www.djangoproject.com/documentation/csrf/ 
     47 
     48humanize 
     49======== 
     50 
     51A set of Django template filters useful for adding a "human touch" to data. 
     52To activate these filters, add ``'django.contrib.english'`` to your 
     53``INSTALLED_APPS`` setting. Once you've done that, use ``{% load english %}`` 
     54in a template, and you'll have access to these filters: 
     55 
     56ordinal 
     57------- 
     58 
     59Converts an integer to its ordinal as a string. 
     60 
     61Examples: 
     62 
     63    * ``1`` becomes ``'1st'``. 
     64    * ``2`` becomes ``'2nd'``. 
     65    * ``3`` becomes ``'3rd'``. 
     66 
     67You can pass in either an integer or a string representation of an integer. 
     68 
     69intcomma 
     70-------- 
     71 
     72Converts an integer to a string containing commas every three digits. 
     73 
     74Examples: 
     75 
     76    * ``4500`` becomes ``'4,500'``. 
     77    * ``45000`` becomes ``'45,000'``. 
     78    * ``450000`` becomes ``'450,000'``. 
     79    * ``4500000`` becomes ``'4,500,000'``. 
     80 
     81You can pass in either an integer or a string representation of an integer. 
     82 
     83intword 
     84------- 
     85 
     86Converts a large integer to a friendly text representation. Works best for 
     87numbers over 1 million. 
     88 
     89Examples: 
     90 
     91    * ``1000000`` becomes ``'1.0 million'``. 
     92    * ``1200000`` becomes ``'1.2 million'``. 
     93    * ``1200000000`` becomes ``'1.2 billion'``. 
     94 
     95Values up to 1000000000000000 (one quadrillion) are supported. 
     96 
     97You can pass in either an integer or a string representation of an integer. 
    4798 
    4899flatpages 
  • django/trunk/docs/templates.txt

    r2812 r3076  
    10921092                                    if no mapping for None is given) 
    10931093==========  ======================  ================================== 
     1094 
     1095Other tags and filter libraries 
     1096=============================== 
     1097 
     1098Django comes with a couple of other template-tag libraries that you have to 
     1099enable explicitly in your ``INSTALLED_APPS`` setting and enable in your 
     1100template with the ``{% load %}`` tag. 
     1101 
     1102django.contrib.humanize 
     1103----------------------- 
     1104 
     1105A set of Django template filters useful for adding a "human touch" to data. See 
     1106the `humanize documentation`_. 
     1107 
     1108.. _humanize documentation: http://www.djangoproject.com/documentation/add_ons/#humanize 
     1109 
     1110django.contrib.markup 
     1111--------------------- 
     1112 
     1113A collection of template filters that implement these common markup languages: 
     1114 
     1115    * Textile 
     1116    * Markdown 
     1117    * ReST (ReStructured Text)