|
1 ============================ |
|
2 The "django.contrib" add-ons |
|
3 ============================ |
|
4 |
|
5 Django aims to follow Python's `"batteries included" philosophy`_. It ships |
|
6 with a variety of extra, optional tools that solve common Web-development |
|
7 problems. |
|
8 |
|
9 This code lives in ``django/contrib`` in the Django distribution. Here's a |
|
10 rundown of the packages in ``contrib``: |
|
11 |
|
12 .. _"batteries included" philosophy: http://docs.python.org/tut/node12.html#batteries-included |
|
13 |
|
14 admin |
|
15 ===== |
|
16 |
|
17 The automatic Django administrative interface. For more information, see |
|
18 `Tutorial 2`_. |
|
19 |
|
20 .. _Tutorial 2: ../tutorial2/ |
|
21 |
|
22 auth |
|
23 ==== |
|
24 |
|
25 Django's authentication framework. |
|
26 |
|
27 See the `authentication documentation`_. |
|
28 |
|
29 .. _authentication documentation: ../authentication/ |
|
30 |
|
31 comments |
|
32 ======== |
|
33 |
|
34 A simple yet flexible comments system. This is not yet documented. |
|
35 |
|
36 contenttypes |
|
37 ============ |
|
38 |
|
39 A light framework for hooking into "types" of content, where each installed |
|
40 Django model is a separate content type. This is not yet documented. |
|
41 |
|
42 csrf |
|
43 ==== |
|
44 |
|
45 A middleware for preventing Cross Site Request Forgeries |
|
46 |
|
47 See the `csrf documentation`_. |
|
48 |
|
49 .. _csrf documentation: ../csrf/ |
|
50 |
|
51 formtools |
|
52 ========= |
|
53 |
|
54 A set of high-level abstractions for Django forms (django.newforms). |
|
55 |
|
56 django.contrib.formtools.preview |
|
57 -------------------------------- |
|
58 |
|
59 An abstraction of the following workflow: |
|
60 |
|
61 "Display an HTML form, force a preview, then do something with the submission." |
|
62 |
|
63 Full documentation for this feature does not yet exist, but you can read the |
|
64 code and docstrings in ``django/contrib/formtools/preview.py`` for a start. |
|
65 |
|
66 humanize |
|
67 ======== |
|
68 |
|
69 A set of Django template filters useful for adding a "human touch" to data. |
|
70 To activate these filters, add ``'django.contrib.humanize'`` to your |
|
71 ``INSTALLED_APPS`` setting. Once you've done that, use ``{% load humanize %}`` |
|
72 in a template, and you'll have access to these filters: |
|
73 |
|
74 apnumber |
|
75 -------- |
|
76 |
|
77 For numbers 1-9, returns the number spelled out. Otherwise, returns the |
|
78 number. This follows Associated Press style. |
|
79 |
|
80 Examples: |
|
81 |
|
82 * ``1`` becomes ``'one'``. |
|
83 * ``2`` becomes ``'two'``. |
|
84 * ``10`` becomes ``10``. |
|
85 |
|
86 You can pass in either an integer or a string representation of an integer. |
|
87 |
|
88 intcomma |
|
89 -------- |
|
90 |
|
91 Converts an integer to a string containing commas every three digits. |
|
92 |
|
93 Examples: |
|
94 |
|
95 * ``4500`` becomes ``'4,500'``. |
|
96 * ``45000`` becomes ``'45,000'``. |
|
97 * ``450000`` becomes ``'450,000'``. |
|
98 * ``4500000`` becomes ``'4,500,000'``. |
|
99 |
|
100 You can pass in either an integer or a string representation of an integer. |
|
101 |
|
102 intword |
|
103 ------- |
|
104 |
|
105 Converts a large integer to a friendly text representation. Works best for |
|
106 numbers over 1 million. |
|
107 |
|
108 Examples: |
|
109 |
|
110 * ``1000000`` becomes ``'1.0 million'``. |
|
111 * ``1200000`` becomes ``'1.2 million'``. |
|
112 * ``1200000000`` becomes ``'1.2 billion'``. |
|
113 |
|
114 Values up to 1000000000000000 (one quadrillion) are supported. |
|
115 |
|
116 You can pass in either an integer or a string representation of an integer. |
|
117 |
|
118 ordinal |
|
119 ------- |
|
120 |
|
121 Converts an integer to its ordinal as a string. |
|
122 |
|
123 Examples: |
|
124 |
|
125 * ``1`` becomes ``'1st'``. |
|
126 * ``2`` becomes ``'2nd'``. |
|
127 * ``3`` becomes ``'3rd'``. |
|
128 |
|
129 You can pass in either an integer or a string representation of an integer. |
|
130 |
|
131 flatpages |
|
132 ========= |
|
133 |
|
134 A framework for managing simple "flat" HTML content in a database. |
|
135 |
|
136 See the `flatpages documentation`_. |
|
137 |
|
138 .. _flatpages documentation: ../flatpages/ |
|
139 |
|
140 localflavor |
|
141 =========== |
|
142 |
|
143 A collection of various Django snippets that are useful only for a particular |
|
144 country or culture. For example, ``django.contrib.localflavor.usa.forms`` |
|
145 contains a ``USZipCodeField`` that you can use to validate U.S. zip codes. |
|
146 |
|
147 markup |
|
148 ====== |
|
149 |
|
150 A collection of template filters that implement these common markup languages: |
|
151 |
|
152 * `Textile`_ |
|
153 * `Markdown`_ |
|
154 * `ReST (ReStructured Text)`_ |
|
155 |
|
156 For documentation, read the source code in django/contrib/markup/templatetags/markup.py. |
|
157 |
|
158 .. _Textile: http://en.wikipedia.org/wiki/Textile_%28markup_language%29 |
|
159 .. _Markdown: http://en.wikipedia.org/wiki/Markdown |
|
160 .. _ReST (ReStructured Text): http://en.wikipedia.org/wiki/ReStructuredText |
|
161 |
|
162 redirects |
|
163 ========= |
|
164 |
|
165 A framework for managing redirects. |
|
166 |
|
167 See the `redirects documentation`_. |
|
168 |
|
169 .. _redirects documentation: ../redirects/ |
|
170 |
|
171 sites |
|
172 ===== |
|
173 |
|
174 A light framework that lets you operate multiple Web sites off of the same |
|
175 database and Django installation. It gives you hooks for associating objects to |
|
176 one or more sites. |
|
177 |
|
178 See the `sites documentation`_. |
|
179 |
|
180 .. _sites documentation: ../sites/ |
|
181 |
|
182 sitemaps |
|
183 ======== |
|
184 |
|
185 A framework for generating Google sitemap XML files. |
|
186 |
|
187 See the `sitemaps documentation`_. |
|
188 |
|
189 .. _sitemaps documentation: ../sitemaps/ |
|
190 |
|
191 syndication |
|
192 =========== |
|
193 |
|
194 A framework for generating syndication feeds, in RSS and Atom, quite easily. |
|
195 |
|
196 See the `syndication documentation`_. |
|
197 |
|
198 .. _syndication documentation: ../syndication/ |
|
199 |
|
200 Other add-ons |
|
201 ============= |
|
202 |
|
203 If you have an idea for functionality to include in ``contrib``, let us know! |
|
204 Code it up, and post it to the `django-users mailing list`_. |
|
205 |
|
206 .. _django-users mailing list: http://groups.google.com/group/django-users |