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