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
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
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
20 .. _"batteries included" philosophy: http://docs.python.org/tut/node12.html#batteries-included
25 The automatic Django administrative interface. For more information, see
28 .. _Tutorial 2: ../tutorial02/
30 Requires the auth_ and contenttypes_ contrib packages to be installed.
35 Django's authentication framework.
37 See the `authentication documentation`_.
39 .. _authentication documentation: ../authentication/
44 A simple yet flexible comments system. This is not yet documented.
49 A light framework for hooking into "types" of content, where each installed
50 Django model is a separate content type. This is not yet documented.
55 A middleware for preventing Cross Site Request Forgeries
57 See the `csrf documentation`_.
59 .. _csrf documentation: ../csrf/
64 A set of high-level abstractions for Django forms (django.newforms).
66 django.contrib.formtools.preview
67 --------------------------------
69 An abstraction of the following workflow:
71 "Display an HTML form, force a preview, then do something with the submission."
73 Full documentation for this feature does not yet exist, but you can read the
74 code and docstrings in ``django/contrib/formtools/preview.py`` for a start.
79 A set of Django template filters useful for adding a "human touch" to data.
80 To activate these filters, add ``'django.contrib.humanize'`` to your
81 ``INSTALLED_APPS`` setting. Once you've done that, use ``{% load humanize %}``
82 in a template, and you'll have access to these filters:
87 For numbers 1-9, returns the number spelled out. Otherwise, returns the
88 number. This follows Associated Press style.
92 * ``1`` becomes ``'one'``.
93 * ``2`` becomes ``'two'``.
94 * ``10`` becomes ``10``.
96 You can pass in either an integer or a string representation of an integer.
101 Converts an integer to a string containing commas every three digits.
105 * ``4500`` becomes ``'4,500'``.
106 * ``45000`` becomes ``'45,000'``.
107 * ``450000`` becomes ``'450,000'``.
108 * ``4500000`` becomes ``'4,500,000'``.
110 You can pass in either an integer or a string representation of an integer.
115 Converts a large integer to a friendly text representation. Works best for
116 numbers over 1 million.
120 * ``1000000`` becomes ``'1.0 million'``.
121 * ``1200000`` becomes ``'1.2 million'``.
122 * ``1200000000`` becomes ``'1.2 billion'``.
124 Values up to 1000000000000000 (one quadrillion) are supported.
126 You can pass in either an integer or a string representation of an integer.
131 Converts an integer to its ordinal as a string.
135 * ``1`` becomes ``'1st'``.
136 * ``2`` becomes ``'2nd'``.
137 * ``3`` becomes ``'3rd'``.
139 You can pass in either an integer or a string representation of an integer.
144 A framework for managing simple "flat" HTML content in a database.
146 See the `flatpages documentation`_.
148 .. _flatpages documentation: ../flatpages/
150 Requires the sites_ contrib package to be installed as well.
155 A collection of various Django snippets that are useful only for a particular
156 country or culture. For example, ``django.contrib.localflavor.usa.forms``
157 contains a ``USZipCodeField`` that you can use to validate U.S. zip codes.
162 A collection of template filters that implement common markup languages:
164 * ``textile`` -- implements `Textile`_
165 * ``markdown`` -- implements `Markdown`_
166 * ``restructuredtext`` -- implements `ReST (ReStructured Text)`_
168 In each case, the filter expects formatted markup as a string and returns a
169 string representing the marked-up text. For example, the ``textile`` filter
170 converts text that is marked-up in Textile format to HTML.
172 To activate these filters, add ``'django.contrib.markup'`` to your
173 ``INSTALLED_APPS`` setting. Once you've done that, use ``{% load markup %}`` in
174 a template, and you'll have access to these filters. For more documentation,
175 read the source code in django/contrib/markup/templatetags/markup.py.
177 .. _Textile: http://en.wikipedia.org/wiki/Textile_%28markup_language%29
178 .. _Markdown: http://en.wikipedia.org/wiki/Markdown
179 .. _ReST (ReStructured Text): http://en.wikipedia.org/wiki/ReStructuredText
184 A framework for managing redirects.
186 See the `redirects documentation`_.
188 .. _redirects documentation: ../redirects/
193 A light framework that lets you operate multiple Web sites off of the same
194 database and Django installation. It gives you hooks for associating objects to
197 See the `sites documentation`_.
199 .. _sites documentation: ../sites/
204 A framework for generating Google sitemap XML files.
206 See the `sitemaps documentation`_.
208 .. _sitemaps documentation: ../sitemaps/
213 A framework for generating syndication feeds, in RSS and Atom, quite easily.
215 See the `syndication documentation`_.
217 .. _syndication documentation: ../syndication/
222 If you have an idea for functionality to include in ``contrib``, let us know!
223 Code it up, and post it to the `django-users mailing list`_.
225 .. _django-users mailing list: http://groups.google.com/group/django-users