1.0 beta 1 release notes
[django.git] / docs / add_ons.txt
blobde1a9136b5cc4fe40701f698b0feb325aea24986
1 ============================
2 The "django.contrib" add-ons
3 ============================
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.
9 This code lives in ``django/contrib`` in the Django distribution. This document
10 gives a rundown of the packages in ``contrib``, along with any dependencies
11 those packages have.
13 .. admonition:: Note
15     For most of these add-ons -- specifically, the add-ons that include either
16     models or template tags -- you'll need to add the package name (e.g.,
17     ``'django.contrib.admin'``) to your ``INSTALLED_APPS`` setting and re-run
18     ``manage.py syncdb``.
20 .. _"batteries included" philosophy: http://docs.python.org/tut/node12.html#batteries-included
22 admin
23 =====
25 The automatic Django administrative interface. For more information, see
26 `Tutorial 2`_ and the `admin documentation`_.
28 .. _Tutorial 2: ../tutorial02/
29 .. _admin documentation: ../admin/
31 Requires the auth_ and contenttypes_ contrib packages to be installed.
33 auth
34 ====
36 Django's authentication framework.
38 See the `authentication documentation`_.
40 .. _authentication documentation: ../authentication/
42 comments
43 ========
45 A simple yet flexible comments system. This is not yet documented.
47 contenttypes
48 ============
50 A light framework for hooking into "types" of content, where each installed
51 Django model is a separate content type.
53 See the `contenttypes documentation`_.
55 .. _contenttypes documentation: ../contenttypes/
57 csrf
58 ====
60 A middleware for preventing Cross Site Request Forgeries
62 See the `csrf documentation`_.
64 .. _csrf documentation: ../csrf/
66 flatpages
67 =========
69 A framework for managing simple "flat" HTML content in a database.
71 See the `flatpages documentation`_.
73 .. _flatpages documentation: ../flatpages/
75 Requires the sites_ contrib package to be installed as well.
77 formtools
78 =========
80 A set of high-level abstractions for Django forms (django.forms).
82 django.contrib.formtools.preview
83 --------------------------------
85 An abstraction of the following workflow:
87 "Display an HTML form, force a preview, then do something with the submission."
89 See the `form preview documentation`_.
91 .. _form preview documentation: ../form_preview/
93 humanize
94 ========
96 A set of Django template filters useful for adding a "human touch" to data.
97 To activate these filters, add ``'django.contrib.humanize'`` to your
98 ``INSTALLED_APPS`` setting. Once you've done that, use ``{% load humanize %}``
99 in a template, and you'll have access to these filters:
101 apnumber
102 --------
104 For numbers 1-9, returns the number spelled out. Otherwise, returns the
105 number. This follows Associated Press style.
107 Examples:
109     * ``1`` becomes ``'one'``.
110     * ``2`` becomes ``'two'``.
111     * ``10`` becomes ``10``.
113 You can pass in either an integer or a string representation of an integer.
115 intcomma
116 --------
118 Converts an integer to a string containing commas every three digits.
120 Examples:
122     * ``4500`` becomes ``'4,500'``.
123     * ``45000`` becomes ``'45,000'``.
124     * ``450000`` becomes ``'450,000'``.
125     * ``4500000`` becomes ``'4,500,000'``.
127 You can pass in either an integer or a string representation of an integer.
129 intword
130 -------
132 Converts a large integer to a friendly text representation. Works best for
133 numbers over 1 million.
135 Examples:
137     * ``1000000`` becomes ``'1.0 million'``.
138     * ``1200000`` becomes ``'1.2 million'``.
139     * ``1200000000`` becomes ``'1.2 billion'``.
141 Values up to 1000000000000000 (one quadrillion) are supported.
143 You can pass in either an integer or a string representation of an integer.
145 ordinal
146 -------
148 Converts an integer to its ordinal as a string.
150 Examples:
152     * ``1`` becomes ``'1st'``.
153     * ``2`` becomes ``'2nd'``.
154     * ``3`` becomes ``'3rd'``.
156 You can pass in either an integer or a string representation of an integer.
158 naturalday
159 ----------
161 **New in Django development version**
163 For dates that are the current day or within one day, return "today",
164 "tomorrow" or "yesterday", as appropriate. Otherwise, format the date using
165 the passed in format string.
167 **Argument:** Date formatting string as described in default tag now_.
169 .. _now: ../templates/#now
171 Examples (when 'today' is 17 Feb 2007):
173     * ``16 Feb 2007`` becomes ``yesterday``.
174     * ``17 Feb 2007`` becomes ``today``.
175     * ``18 Feb 2007`` becomes ``tomorrow``.
176     * Any other day is formatted according to given argument or the
177       `DATE_FORMAT`_ setting if no argument is given.
179 .. _DATE_FORMAT: ../settings/#date_format
181 localflavor
182 ===========
184 A collection of various Django snippets that are useful only for a particular
185 country or culture. For example, ``django.contrib.localflavor.us.forms``
186 contains a ``USZipCodeField`` that you can use to validate U.S. zip codes.
188 See the `localflavor documentation`_.
190 .. _localflavor documentation: ../localflavor/
192 markup
193 ======
195 A collection of template filters that implement common markup languages:
197     * ``textile`` -- implements `Textile`_
198     * ``markdown`` -- implements `Markdown`_
199     * ``restructuredtext`` -- implements `ReST (ReStructured Text)`_
201 In each case, the filter expects formatted markup as a string and returns a
202 string representing the marked-up text. For example, the ``textile`` filter
203 converts text that is marked-up in Textile format to HTML.
205 To activate these filters, add ``'django.contrib.markup'`` to your
206 ``INSTALLED_APPS`` setting. Once you've done that, use ``{% load markup %}`` in
207 a template, and you'll have access to these filters. For more documentation,
208 read the source code in django/contrib/markup/templatetags/markup.py.
210 .. _Textile: http://en.wikipedia.org/wiki/Textile_%28markup_language%29
211 .. _Markdown: http://en.wikipedia.org/wiki/Markdown
212 .. _ReST (ReStructured Text): http://en.wikipedia.org/wiki/ReStructuredText
214 redirects
215 =========
217 A framework for managing redirects.
219 See the `redirects documentation`_.
221 .. _redirects documentation: ../redirects/
223 sessions
224 ========
226 A framework for storing data in anonymous sessions.
228 See the `sessions documentation`_.
230 .. _sessions documentation: ../sessions/
232 sites
233 =====
235 A light framework that lets you operate multiple Web sites off of the same
236 database and Django installation. It gives you hooks for associating objects to
237 one or more sites.
239 See the `sites documentation`_.
241 .. _sites documentation: ../sites/
243 sitemaps
244 ========
246 A framework for generating Google sitemap XML files.
248 See the `sitemaps documentation`_.
250 .. _sitemaps documentation: ../sitemaps/
252 syndication
253 ===========
255 A framework for generating syndication feeds, in RSS and Atom, quite easily.
257 See the `syndication documentation`_.
259 .. _syndication documentation: ../syndication_feeds/
261 webdesign
262 =========
264 Helpers and utilities targeted primarily at Web *designers* rather than
265 Web *developers*.
267 See the `Web design helpers documentation`_.
269 .. _Web design helpers documentation: ../webdesign/
271 Other add-ons
272 =============
274 If you have an idea for functionality to include in ``contrib``, let us know!
275 Code it up, and post it to the `django-users mailing list`_.
277 .. _django-users mailing list: http://groups.google.com/group/django-users