Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14804 -- Metadata improvement, broken link fix, and alphabetiz…

…ation of template filters in contrib.humanize reference docs. Thanks to adamv for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14746 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a0b3306349ad4368b842389774bfaf9174fae119 1 parent 08daa3d
authored November 29, 2010

Showing 1 changed file with 34 additions and 23 deletions. Show diff stats Hide diff stats

  1. 57  docs/ref/contrib/humanize.txt
57  docs/ref/contrib/humanize.txt
@@ -10,7 +10,10 @@ A set of Django template filters useful for adding a "human touch" to data.
10 10
 
11 11
 To activate these filters, add ``'django.contrib.humanize'`` to your
12 12
 :setting:`INSTALLED_APPS` setting. Once you've done that, use
13  
-``{% load humanize %}`` in a template, and you'll have access to these filters:
  13
+``{% load humanize %}`` in a template, and you'll have access to the following
  14
+filters.
  15
+
  16
+.. templatefilter:: apnumber
14 17
 
15 18
 apnumber
16 19
 --------
@@ -20,12 +23,14 @@ number. This follows Associated Press style.
20 23
 
21 24
 Examples:
22 25
 
23  
-    * ``1`` becomes ``'one'``.
24  
-    * ``2`` becomes ``'two'``.
  26
+    * ``1`` becomes ``one``.
  27
+    * ``2`` becomes ``two``.
25 28
     * ``10`` becomes ``10``.
26 29
 
27 30
 You can pass in either an integer or a string representation of an integer.
28 31
 
  32
+.. templatefilter:: intcomma
  33
+
29 34
 intcomma
30 35
 --------
31 36
 
@@ -33,13 +38,15 @@ Converts an integer to a string containing commas every three digits.
33 38
 
34 39
 Examples:
35 40
 
36  
-    * ``4500`` becomes ``'4,500'``.
37  
-    * ``45000`` becomes ``'45,000'``.
38  
-    * ``450000`` becomes ``'450,000'``.
39  
-    * ``4500000`` becomes ``'4,500,000'``.
  41
+    * ``4500`` becomes ``4,500``.
  42
+    * ``45000`` becomes ``45,000``.
  43
+    * ``450000`` becomes ``450,000``.
  44
+    * ``4500000`` becomes ``4,500,000``.
40 45
 
41 46
 You can pass in either an integer or a string representation of an integer.
42 47
 
  48
+.. templatefilter:: intword
  49
+
43 50
 intword
44 51
 -------
45 52
 
@@ -48,26 +55,15 @@ numbers over 1 million.
48 55
 
49 56
 Examples:
50 57
 
51  
-    * ``1000000`` becomes ``'1.0 million'``.
52  
-    * ``1200000`` becomes ``'1.2 million'``.
53  
-    * ``1200000000`` becomes ``'1.2 billion'``.
  58
+    * ``1000000`` becomes ``1.0 million``.
  59
+    * ``1200000`` becomes ``1.2 million``.
  60
+    * ``1200000000`` becomes ``1.2 billion``.
54 61
 
55 62
 Values up to 1000000000000000 (one quadrillion) are supported.
56 63
 
57 64
 You can pass in either an integer or a string representation of an integer.
58 65
 
59  
-ordinal
60  
--------
61  
-
62  
-Converts an integer to its ordinal as a string.
63  
-
64  
-Examples:
65  
-
66  
-    * ``1`` becomes ``'1st'``.
67  
-    * ``2`` becomes ``'2nd'``.
68  
-    * ``3`` becomes ``'3rd'``.
69  
-
70  
-You can pass in either an integer or a string representation of an integer.
  66
+.. templatefilter:: naturalday
71 67
 
72 68
 naturalday
73 69
 ----------
@@ -78,7 +74,7 @@ For dates that are the current day or within one day, return "today",
78 74
 "tomorrow" or "yesterday", as appropriate. Otherwise, format the date using
79 75
 the passed in format string.
80 76
 
81  
-**Argument:** Date formatting string as described in the :ttag:`now` tag.
  77
+**Argument:** Date formatting string as described in the :tfilter:`date` tag.
82 78
 
83 79
 Examples (when 'today' is 17 Feb 2007):
84 80
 
@@ -87,3 +83,18 @@ Examples (when 'today' is 17 Feb 2007):
87 83
     * ``18 Feb 2007`` becomes ``tomorrow``.
88 84
     * Any other day is formatted according to given argument or the
89 85
       :setting:`DATE_FORMAT` setting if no argument is given.
  86
+
  87
+.. templatefilter:: ordinal
  88
+
  89
+ordinal
  90
+-------
  91
+
  92
+Converts an integer to its ordinal as a string.
  93
+
  94
+Examples:
  95
+
  96
+    * ``1`` becomes ``1st``.
  97
+    * ``2`` becomes ``2nd``.
  98
+    * ``3`` becomes ``3rd``.
  99
+
  100
+You can pass in either an integer or a string representation of an integer.

0 notes on commit a0b3306

Please sign in to comment.
Something went wrong with that request. Please try again.