summaryrefslogtreecommitdiff
path: root/docs/add_ons.txt
blob: 2b2de76cba8d552120cb41accd6834c12f5b3d5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
============================
The "django.contrib" add-ons
============================

Django aims to follow Python's `"batteries included" philosophy`_. It ships
with a variety of extra, optional tools that solve common Web-development
problems.

This code lives in ``django/contrib`` in the Django distribution. This document
gives a rundown of the packages in ``contrib``, along with any dependencies
those packages have.

.. admonition:: Note

    For most of these add-ons -- specifically, the add-ons that include either
    models or template tags -- you'll need to add the package name (e.g.,
    ``'django.contrib.admin'``) to your ``INSTALLED_APPS`` setting and re-run
    ``manage.py syncdb``.

.. _"batteries included" philosophy: http://docs.python.org/tut/node12.html#batteries-included

admin
=====

The automatic Django administrative interface. For more information, see
`Tutorial 2`_ and the `admin documentation`_.

.. _Tutorial 2: ../tutorial02/
.. _admin documentation: ../admin/

Requires the auth_ and contenttypes_ contrib packages to be installed.

auth
====

Django's authentication framework.

See the `authentication documentation`_.

.. _authentication documentation: ../authentication/

comments
========

A simple yet flexible comments system. This is not yet documented.

contenttypes
============

A light framework for hooking into "types" of content, where each installed
Django model is a separate content type.

See the `contenttypes documentation`_.

.. _contenttypes documentation: ../contenttypes/

csrf
====

A middleware for preventing Cross Site Request Forgeries

See the `csrf documentation`_.

.. _csrf documentation: ../csrf/

flatpages
=========

A framework for managing simple "flat" HTML content in a database.

See the `flatpages documentation`_.

.. _flatpages documentation: ../flatpages/

Requires the sites_ contrib package to be installed as well.

formtools
=========

A set of high-level abstractions for Django forms (django.forms).

django.contrib.formtools.preview
--------------------------------

An abstraction of the following workflow:

"Display an HTML form, force a preview, then do something with the submission."

See the `form preview documentation`_.

.. _form preview documentation: ../form_preview/

humanize
========

A set of Django template filters useful for adding a "human touch" to data.
To activate these filters, add ``'django.contrib.humanize'`` to your
``INSTALLED_APPS`` setting. Once you've done that, use ``{% load humanize %}``
in a template, and you'll have access to these filters:

apnumber
--------

For numbers 1-9, returns the number spelled out. Otherwise, returns the
number. This follows Associated Press style.

Examples:

    * ``1`` becomes ``'one'``.
    * ``2`` becomes ``'two'``.
    * ``10`` becomes ``10``.

You can pass in either an integer or a string representation of an integer.

intcomma
--------

Converts an integer to a string containing commas every three digits.

Examples:

    * ``4500`` becomes ``'4,500'``.
    * ``45000`` becomes ``'45,000'``.
    * ``450000`` becomes ``'450,000'``.
    * ``4500000`` becomes ``'4,500,000'``.

You can pass in either an integer or a string representation of an integer.

intword
-------

Converts a large integer to a friendly text representation. Works best for
numbers over 1 million.

Examples:

    * ``1000000`` becomes ``'1.0 million'``.
    * ``1200000`` becomes ``'1.2 million'``.
    * ``1200000000`` becomes ``'1.2 billion'``.

Values up to 1000000000000000 (one quadrillion) are supported.

You can pass in either an integer or a string representation of an integer.

ordinal
-------

Converts an integer to its ordinal as a string.

Examples:

    * ``1`` becomes ``'1st'``.
    * ``2`` becomes ``'2nd'``.
    * ``3`` becomes ``'3rd'``.

You can pass in either an integer or a string representation of an integer.

naturalday
----------

**New in Django development version**

For dates that are the current day or within one day, return "today",
"tomorrow" or "yesterday", as appropriate. Otherwise, format the date using
the passed in format string.

**Argument:** Date formatting string as described in default tag now_.

.. _now: ../templates/#now

Examples (when 'today' is 17 Feb 2007):

    * ``16 Feb 2007`` becomes ``yesterday``.
    * ``17 Feb 2007`` becomes ``today``.
    * ``18 Feb 2007`` becomes ``tomorrow``.
    * Any other day is formatted according to given argument or the
      `DATE_FORMAT`_ setting if no argument is given.

.. _DATE_FORMAT: ../settings/#date_format

localflavor
===========

A collection of various Django snippets that are useful only for a particular
country or culture. For example, ``django.contrib.localflavor.us.forms``
contains a ``USZipCodeField`` that you can use to validate U.S. zip codes.

See the `localflavor documentation`_.

.. _localflavor documentation: ../localflavor/

markup
======

A collection of template filters that implement common markup languages:

    * ``textile`` -- implements `Textile`_
    * ``markdown`` -- implements `Markdown`_
    * ``restructuredtext`` -- implements `ReST (ReStructured Text)`_

In each case, the filter expects formatted markup as a string and returns a
string representing the marked-up text. For example, the ``textile`` filter
converts text that is marked-up in Textile format to HTML.

To activate these filters, add ``'django.contrib.markup'`` to your
``INSTALLED_APPS`` setting. Once you've done that, use ``{% load markup %}`` in
a template, and you'll have access to these filters. For more documentation,
read the source code in django/contrib/markup/templatetags/markup.py.

.. _Textile: http://en.wikipedia.org/wiki/Textile_%28markup_language%29
.. _Markdown: http://en.wikipedia.org/wiki/Markdown
.. _ReST (ReStructured Text): http://en.wikipedia.org/wiki/ReStructuredText

redirects
=========

A framework for managing redirects.

See the `redirects documentation`_.

.. _redirects documentation: ../redirects/

sessions
========

A framework for storing data in anonymous sessions.

See the `sessions documentation`_.

.. _sessions documentation: ../sessions/

sites
=====

A light framework that lets you operate multiple Web sites off of the same
database and Django installation. It gives you hooks for associating objects to
one or more sites.

See the `sites documentation`_.

.. _sites documentation: ../sites/

sitemaps
========

A framework for generating Google sitemap XML files.

See the `sitemaps documentation`_.

.. _sitemaps documentation: ../sitemaps/

syndication
===========

A framework for generating syndication feeds, in RSS and Atom, quite easily.

See the `syndication documentation`_.

.. _syndication documentation: ../syndication_feeds/

webdesign
=========

Helpers and utilties targeted primarily at Web *designers* rather than
Web *developers*.

See the `Web design helpers documentation`_.

.. _Web design helpers documentation: ../webdesign/

Other add-ons
=============

If you have an idea for functionality to include in ``contrib``, let us know!
Code it up, and post it to the `django-users mailing list`_.

.. _django-users mailing list: http://groups.google.com/group/django-users