Django

Code

root/django/branches/full-history/docs/add_ons.txt

Revision 4869, 5.7 kB (checked in by utrebec, 2 years ago)

[full-history]
svnmerge: merging in revision(s) 4816,4818-4823,4825-4835,4837,4844-4850,4856-4868 from "http://code.djangoproject.com/svn/django/trunk"

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