Package django :: Package contrib :: Package humanize :: Package templatetags :: Module humanize
[hide private]
[frames] | no frames]

Module humanize

source code

Functions [hide private]
 
ordinal(value)
Converts an integer to its ordinal as a string.
source code
 
intcomma(value)
Converts an integer to a string containing commas every three digits.
source code
 
intword(value)
Converts a large integer to a friendly text representation.
source code
 
apnumber(value)
For numbers 1-9, returns the number spelled out.
source code
 
naturalday(value, arg=None)
For date values that are tomorrow, today or yesterday compared to present day returns representing string.
source code
Variables [hide private]
  register = template.Library()
Function Details [hide private]

ordinal(value)

source code 

Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd', 3 is '3rd', etc. Works for any integer.

intcomma(value)

source code 

Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'.

intword(value)

source code 

Converts a large integer to a friendly text representation. Works best for numbers over 1 million. For example, 1000000 becomes '1.0 million', 1200000 becomes '1.2 million' and '1200000000' becomes '1.2 billion'.

apnumber(value)

source code 

For numbers 1-9, returns the number spelled out. Otherwise, returns the number. This follows Associated Press style.

naturalday(value, arg=None)

source code 

For date values that are tomorrow, today or yesterday compared to present day returns representing string. Otherwise, returns a string formatted according to settings.DATE_FORMAT.