Fixed #14141: docs now use the :doc: construct for links between documents.
Thanks, Ramiro Morales. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13608 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a352154e42
commit
728effcfbd
|
@ -78,11 +78,11 @@ class VersionDirective(Directive):
|
||||||
ret.append(node)
|
ret.append(node)
|
||||||
if not is_nextversion:
|
if not is_nextversion:
|
||||||
if len(self.arguments) == 1:
|
if len(self.arguments) == 1:
|
||||||
linktext = 'Please, see the release notes <releases-%s>' % (arg0)
|
linktext = 'Please, see the release notes </releases/%s>' % (arg0)
|
||||||
try:
|
try:
|
||||||
xrefs = roles.XRefRole()('std:ref', linktext, linktext, self.lineno, self.state) # Sphinx >= 1.0
|
xrefs = roles.XRefRole()('doc', linktext, linktext, self.lineno, self.state) # Sphinx >= 1.0
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
xrefs = roles.xfileref_role('ref', linktext, linktext, self.lineno, self.state) # Sphinx < 1.0
|
xrefs = roles.xfileref_role('doc', linktext, linktext, self.lineno, self.state) # Sphinx < 1.0
|
||||||
node.extend(xrefs[0])
|
node.extend(xrefs[0])
|
||||||
node['version'] = arg0
|
node['version'] = arg0
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _faq-admin:
|
|
||||||
|
|
||||||
FAQ: The admin
|
FAQ: The admin
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
@ -32,7 +30,7 @@ How can I prevent the cache middleware from caching the admin site?
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
|
|
||||||
Set the :setting:`CACHE_MIDDLEWARE_ANONYMOUS_ONLY` setting to ``True``. See the
|
Set the :setting:`CACHE_MIDDLEWARE_ANONYMOUS_ONLY` setting to ``True``. See the
|
||||||
:ref:`cache documentation <topics-cache>` for more information.
|
:doc:`cache documentation </topics/cache>` for more information.
|
||||||
|
|
||||||
How do I automatically set a field's value to the user who last edited the object in the admin?
|
How do I automatically set a field's value to the user who last edited the object in the admin?
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
@ -91,5 +89,5 @@ We like it, but if you don't agree, you can modify the admin site's
|
||||||
presentation by editing the CSS stylesheet and/or associated image files. The
|
presentation by editing the CSS stylesheet and/or associated image files. The
|
||||||
site is built using semantic HTML and plenty of CSS hooks, so any changes you'd
|
site is built using semantic HTML and plenty of CSS hooks, so any changes you'd
|
||||||
like to make should be possible by editing the stylesheet. We've got a
|
like to make should be possible by editing the stylesheet. We've got a
|
||||||
:ref:`guide to the CSS used in the admin <obsolete-admin-css>` to get you started.
|
:doc:`guide to the CSS used in the admin </obsolete/admin-css>` to get you started.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _faq-contributing:
|
|
||||||
|
|
||||||
FAQ: Contributing code
|
FAQ: Contributing code
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
@ -7,7 +5,7 @@ How can I get started contributing code to Django?
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
Thanks for asking! We've written an entire document devoted to this question.
|
Thanks for asking! We've written an entire document devoted to this question.
|
||||||
It's titled :ref:`Contributing to Django <internals-contributing>`.
|
It's titled :doc:`Contributing to Django </internals/contributing>`.
|
||||||
|
|
||||||
I submitted a bug fix in the ticket system several weeks ago. Why are you ignoring my patch?
|
I submitted a bug fix in the ticket system several weeks ago. Why are you ignoring my patch?
|
||||||
--------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _faq-general:
|
|
||||||
|
|
||||||
FAQ: General
|
FAQ: General
|
||||||
============
|
============
|
||||||
|
|
||||||
|
@ -63,15 +61,15 @@ at any level -- database servers, caching servers or Web/application servers.
|
||||||
|
|
||||||
The framework cleanly separates components such as its database layer and
|
The framework cleanly separates components such as its database layer and
|
||||||
application layer. And it ships with a simple-yet-powerful
|
application layer. And it ships with a simple-yet-powerful
|
||||||
:ref:`cache framework <topics-cache>`.
|
:doc:`cache framework </topics/cache>`.
|
||||||
|
|
||||||
Who's behind this?
|
Who's behind this?
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Django was originally developed at World Online, the Web department of a
|
Django was originally developed at World Online, the Web department of a
|
||||||
newspaper in Lawrence, Kansas, USA. Django's now run by an international team of
|
newspaper in Lawrence, Kansas, USA. Django's now run by an international team of
|
||||||
volunteers; you can read all about them over at the :ref:`list of committers
|
volunteers; you can read all about them over at the :doc:`list of committers
|
||||||
<internals-committers>`
|
</internals/committers>`
|
||||||
|
|
||||||
Which sites use Django?
|
Which sites use Django?
|
||||||
-----------------------
|
-----------------------
|
||||||
|
@ -146,7 +144,7 @@ philosophies 100%.
|
||||||
Like we said: We're picky.
|
Like we said: We're picky.
|
||||||
|
|
||||||
We've documented our philosophies on the
|
We've documented our philosophies on the
|
||||||
:ref:`design philosophies page <misc-design-philosophies>`.
|
:doc:`design philosophies page </misc/design-philosophies>`.
|
||||||
|
|
||||||
Is Django a content-management-system (CMS)?
|
Is Django a content-management-system (CMS)?
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _faq-help:
|
|
||||||
|
|
||||||
FAQ: Getting Help
|
FAQ: Getting Help
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _faq-index:
|
|
||||||
|
|
||||||
==========
|
==========
|
||||||
Django FAQ
|
Django FAQ
|
||||||
==========
|
==========
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _faq-install:
|
|
||||||
|
|
||||||
FAQ: Installation
|
FAQ: Installation
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
@ -7,9 +5,9 @@ How do I get started?
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
#. `Download the code`_.
|
#. `Download the code`_.
|
||||||
#. Install Django (read the :ref:`installation guide <intro-install>`).
|
#. Install Django (read the :doc:`installation guide </intro/install>`).
|
||||||
#. Walk through the :ref:`tutorial <intro-tutorial01>`.
|
#. Walk through the :doc:`tutorial </intro/tutorial01>`.
|
||||||
#. Check out the rest of the :ref:`documentation <index>`, and `ask questions`_ if you
|
#. Check out the rest of the :doc:`documentation </index>`, and `ask questions`_ if you
|
||||||
run into trouble.
|
run into trouble.
|
||||||
|
|
||||||
.. _`Download the code`: http://www.djangoproject.com/download/
|
.. _`Download the code`: http://www.djangoproject.com/download/
|
||||||
|
@ -26,7 +24,7 @@ For a development environment -- if you just want to experiment with Django --
|
||||||
you don't need to have a separate Web server installed; Django comes with its
|
you don't need to have a separate Web server installed; Django comes with its
|
||||||
own lightweight development server. For a production environment, Django
|
own lightweight development server. For a production environment, Django
|
||||||
follows the WSGI_ spec, which means it can run on a variety of server
|
follows the WSGI_ spec, which means it can run on a variety of server
|
||||||
platforms. See :ref:`Deploying Django <howto-deployment-index>` for some
|
platforms. See :doc:`Deploying Django </howto/deployment/index>` for some
|
||||||
popular alternatives. Also, the `server arrangements wiki page`_ contains
|
popular alternatives. Also, the `server arrangements wiki page`_ contains
|
||||||
details for several deployment strategies.
|
details for several deployment strategies.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _faq-models:
|
|
||||||
|
|
||||||
FAQ: Databases and models
|
FAQ: Databases and models
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
@ -30,7 +28,7 @@ backend, and not all backends provide a way to retrieve the SQL after quoting.
|
||||||
|
|
||||||
.. versionadded:: 1.2
|
.. versionadded:: 1.2
|
||||||
|
|
||||||
If you are using :ref:`multiple databases<topics-db-multi-db>`, you can use the
|
If you are using :doc:`multiple databases</topics/db/multi-db>`, you can use the
|
||||||
same interface on each member of the ``connections`` dictionary::
|
same interface on each member of the ``connections`` dictionary::
|
||||||
|
|
||||||
>>> from django.db import connections
|
>>> from django.db import connections
|
||||||
|
@ -39,7 +37,7 @@ same interface on each member of the ``connections`` dictionary::
|
||||||
Can I use Django with a pre-existing database?
|
Can I use Django with a pre-existing database?
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
Yes. See :ref:`Integrating with a legacy database <howto-legacy-databases>`.
|
Yes. See :doc:`Integrating with a legacy database </howto/legacy-databases>`.
|
||||||
|
|
||||||
If I make changes to a model, how do I update the database?
|
If I make changes to a model, how do I update the database?
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _faq-usage:
|
|
||||||
|
|
||||||
FAQ: Using Django
|
FAQ: Using Django
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
|
|
@ -10,18 +10,18 @@ Glossary
|
||||||
An attribute on a :term:`model`; a given field usually maps directly to
|
An attribute on a :term:`model`; a given field usually maps directly to
|
||||||
a single database column.
|
a single database column.
|
||||||
|
|
||||||
See :ref:`topics-db-models`.
|
See :doc:`/topics/db/models`.
|
||||||
|
|
||||||
generic view
|
generic view
|
||||||
A higher-order :term:`view` function that provides an abstract/generic
|
A higher-order :term:`view` function that provides an abstract/generic
|
||||||
implementation of a common idiom or pattern found in view development.
|
implementation of a common idiom or pattern found in view development.
|
||||||
|
|
||||||
See :ref:`ref-generic-views`.
|
See :doc:`/ref/generic-views`.
|
||||||
|
|
||||||
model
|
model
|
||||||
Models store your application's data.
|
Models store your application's data.
|
||||||
|
|
||||||
See :ref:`topics-db-models`.
|
See :doc:`/topics/db/models`.
|
||||||
|
|
||||||
MTV
|
MTV
|
||||||
See :ref:`mtv`.
|
See :ref:`mtv`.
|
||||||
|
@ -57,7 +57,7 @@ Glossary
|
||||||
queryset
|
queryset
|
||||||
An object representing some set of rows to be fetched from the database.
|
An object representing some set of rows to be fetched from the database.
|
||||||
|
|
||||||
See :ref:`topics-db-queries`.
|
See :doc:`/topics/db/queries`.
|
||||||
|
|
||||||
slug
|
slug
|
||||||
A short label for something, containing only letters, numbers,
|
A short label for something, containing only letters, numbers,
|
||||||
|
@ -75,7 +75,7 @@ Glossary
|
||||||
template helps to abstract the presentation of data from the data
|
template helps to abstract the presentation of data from the data
|
||||||
itself.
|
itself.
|
||||||
|
|
||||||
See :ref:`topics-templates`.
|
See :doc:`/topics/templates`.
|
||||||
|
|
||||||
view
|
view
|
||||||
A function responsible for rending a page.
|
A function responsible for rending a page.
|
|
@ -1,12 +1,10 @@
|
||||||
.. _howto-apache-auth:
|
|
||||||
|
|
||||||
=========================================================
|
=========================================================
|
||||||
Authenticating against Django's user database from Apache
|
Authenticating against Django's user database from Apache
|
||||||
=========================================================
|
=========================================================
|
||||||
|
|
||||||
Since keeping multiple authentication databases in sync is a common problem when
|
Since keeping multiple authentication databases in sync is a common problem when
|
||||||
dealing with Apache, you can configuring Apache to authenticate against Django's
|
dealing with Apache, you can configuring Apache to authenticate against Django's
|
||||||
:ref:`authentication system <topics-auth>` directly. For example, you
|
:doc:`authentication system </topics/auth>` directly. For example, you
|
||||||
could:
|
could:
|
||||||
|
|
||||||
* Serve static/media files directly from Apache only to authenticated users.
|
* Serve static/media files directly from Apache only to authenticated users.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-auth-remote-user:
|
|
||||||
|
|
||||||
====================================
|
====================================
|
||||||
Authentication using ``REMOTE_USER``
|
Authentication using ``REMOTE_USER``
|
||||||
====================================
|
====================================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-custom-file-storage:
|
|
||||||
|
|
||||||
Writing a custom storage system
|
Writing a custom storage system
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
|
@ -37,7 +35,7 @@ You'll need to follow these steps:
|
||||||
the ``path()`` method.
|
the ``path()`` method.
|
||||||
|
|
||||||
Your custom storage system may override any of the storage methods explained in
|
Your custom storage system may override any of the storage methods explained in
|
||||||
:ref:`ref-files-storage`, but you **must** implement the following methods:
|
:doc:`/ref/files/storage`, but you **must** implement the following methods:
|
||||||
|
|
||||||
* :meth:`Storage.delete`
|
* :meth:`Storage.delete`
|
||||||
* :meth:`Storage.exists`
|
* :meth:`Storage.exists`
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-custom-management-commands:
|
|
||||||
|
|
||||||
====================================
|
====================================
|
||||||
Writing custom django-admin commands
|
Writing custom django-admin commands
|
||||||
====================================
|
====================================
|
||||||
|
@ -10,7 +8,7 @@ Applications can register their own actions with ``manage.py``. For example,
|
||||||
you might want to add a ``manage.py`` action for a Django app that you're
|
you might want to add a ``manage.py`` action for a Django app that you're
|
||||||
distributing. In this document, we will be building a custom ``closepoll``
|
distributing. In this document, we will be building a custom ``closepoll``
|
||||||
command for the ``polls`` application from the
|
command for the ``polls`` application from the
|
||||||
:ref:`tutorial<intro-tutorial01>`.
|
:doc:`tutorial</intro/tutorial01>`.
|
||||||
|
|
||||||
To do this, just add a ``management/commands`` directory to the application.
|
To do this, just add a ``management/commands`` directory to the application.
|
||||||
Each Python module in that directory will be auto-discovered and registered as
|
Each Python module in that directory will be auto-discovered and registered as
|
||||||
|
@ -77,7 +75,7 @@ The new custom command can be called using ``python manage.py closepoll
|
||||||
The ``handle()`` method takes zero or more ``poll_ids`` and sets ``poll.opened``
|
The ``handle()`` method takes zero or more ``poll_ids`` and sets ``poll.opened``
|
||||||
to ``False`` for each one. If the user referenced any nonexistant polls, a
|
to ``False`` for each one. If the user referenced any nonexistant polls, a
|
||||||
:class:`CommandError` is raised. The ``poll.opened`` attribute does not exist
|
:class:`CommandError` is raised. The ``poll.opened`` attribute does not exist
|
||||||
in the :ref:`tutorial<intro-tutorial01>` and was added to
|
in the :doc:`tutorial</intro/tutorial01>` and was added to
|
||||||
``polls.models.Poll`` for this example.
|
``polls.models.Poll`` for this example.
|
||||||
|
|
||||||
The same ``closepoll`` could be easily modified to delete a given poll instead
|
The same ``closepoll`` could be easily modified to delete a given poll instead
|
||||||
|
@ -99,7 +97,7 @@ must be added to :attr:`~BaseCommand.option_list` like this:
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
In addition to being able to add custom command line options, all
|
In addition to being able to add custom command line options, all
|
||||||
:ref:`management commands<ref-django-admin>` can accept some
|
:doc:`management commands</ref/django-admin>` can accept some
|
||||||
default options such as :djadminopt:`--verbosity` and :djadminopt:`--traceback`.
|
default options such as :djadminopt:`--verbosity` and :djadminopt:`--traceback`.
|
||||||
|
|
||||||
Command objects
|
Command objects
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-custom-model-fields:
|
|
||||||
|
|
||||||
===========================
|
===========================
|
||||||
Writing custom model fields
|
Writing custom model fields
|
||||||
===========================
|
===========================
|
||||||
|
@ -10,7 +8,7 @@ Writing custom model fields
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
|
||||||
The :ref:`model reference <topics-db-models>` documentation explains how to use
|
The :doc:`model reference </topics/db/models>` documentation explains how to use
|
||||||
Django's standard field classes -- :class:`~django.db.models.CharField`,
|
Django's standard field classes -- :class:`~django.db.models.CharField`,
|
||||||
:class:`~django.db.models.DateField`, etc. For many purposes, those classes are
|
:class:`~django.db.models.DateField`, etc. For many purposes, those classes are
|
||||||
all you'll need. Sometimes, though, the Django version won't meet your precise
|
all you'll need. Sometimes, though, the Django version won't meet your precise
|
||||||
|
@ -109,7 +107,7 @@ What does a field class do?
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
All of Django's fields (and when we say *fields* in this document, we always
|
All of Django's fields (and when we say *fields* in this document, we always
|
||||||
mean model fields and not :ref:`form fields <ref-forms-fields>`) are subclasses
|
mean model fields and not :doc:`form fields </ref/forms/fields>`) are subclasses
|
||||||
of :class:`django.db.models.Field`. Most of the information that Django records
|
of :class:`django.db.models.Field`. Most of the information that Django records
|
||||||
about a field is common to all fields -- name, help text, uniqueness and so
|
about a field is common to all fields -- name, help text, uniqueness and so
|
||||||
forth. Storing all that information is handled by ``Field``. We'll get into the
|
forth. Storing all that information is handled by ``Field``. We'll get into the
|
||||||
|
@ -124,7 +122,7 @@ when the model class is created (the precise details of how this is done are
|
||||||
unimportant here). This is because the field classes aren't necessary when
|
unimportant here). This is because the field classes aren't necessary when
|
||||||
you're just creating and modifying attributes. Instead, they provide the
|
you're just creating and modifying attributes. Instead, they provide the
|
||||||
machinery for converting between the attribute value and what is stored in the
|
machinery for converting between the attribute value and what is stored in the
|
||||||
database or sent to the :ref:`serializer <topics-serialization>`.
|
database or sent to the :doc:`serializer </topics/serialization>`.
|
||||||
|
|
||||||
Keep this in mind when creating your own custom fields. The Django ``Field``
|
Keep this in mind when creating your own custom fields. The Django ``Field``
|
||||||
subclass you write provides the machinery for converting between your Python
|
subclass you write provides the machinery for converting between your Python
|
||||||
|
@ -209,8 +207,8 @@ parameters:
|
||||||
* :attr:`~django.db.models.Field.default`
|
* :attr:`~django.db.models.Field.default`
|
||||||
* :attr:`~django.db.models.Field.editable`
|
* :attr:`~django.db.models.Field.editable`
|
||||||
* :attr:`~django.db.models.Field.serialize`: If ``False``, the field will
|
* :attr:`~django.db.models.Field.serialize`: If ``False``, the field will
|
||||||
not be serialized when the model is passed to Django's :ref:`serializers
|
not be serialized when the model is passed to Django's :doc:`serializers
|
||||||
<topics-serialization>`. Defaults to ``True``.
|
</topics/serialization>`. Defaults to ``True``.
|
||||||
* :attr:`~django.db.models.Field.unique_for_date`
|
* :attr:`~django.db.models.Field.unique_for_date`
|
||||||
* :attr:`~django.db.models.Field.unique_for_month`
|
* :attr:`~django.db.models.Field.unique_for_month`
|
||||||
* :attr:`~django.db.models.Field.unique_for_year`
|
* :attr:`~django.db.models.Field.unique_for_year`
|
||||||
|
@ -225,8 +223,8 @@ parameters:
|
||||||
inheritance. For advanced use only.
|
inheritance. For advanced use only.
|
||||||
|
|
||||||
All of the options without an explanation in the above list have the same
|
All of the options without an explanation in the above list have the same
|
||||||
meaning they do for normal Django fields. See the :ref:`field documentation
|
meaning they do for normal Django fields. See the :doc:`field documentation
|
||||||
<ref-models-fields>` for examples and details.
|
</ref/models/fields>` for examples and details.
|
||||||
|
|
||||||
The ``SubfieldBase`` metaclass
|
The ``SubfieldBase`` metaclass
|
||||||
------------------------------
|
------------------------------
|
||||||
|
@ -270,8 +268,8 @@ value. This means that whenever a value may be assigned to the field,
|
||||||
you need to ensure that it will be of the correct datatype, or that
|
you need to ensure that it will be of the correct datatype, or that
|
||||||
you handle any exceptions.
|
you handle any exceptions.
|
||||||
|
|
||||||
This is especially important if you use :ref:`ModelForms
|
This is especially important if you use :doc:`ModelForms
|
||||||
<topics-forms-modelforms>`. When saving a ModelForm, Django will use
|
</topics/forms/modelforms>`. When saving a ModelForm, Django will use
|
||||||
form values to instantiate model instances. However, if the cleaned
|
form values to instantiate model instances. However, if the cleaned
|
||||||
form data can't be used as valid input to the field, the normal form
|
form data can't be used as valid input to the field, the normal form
|
||||||
validation process will break.
|
validation process will break.
|
||||||
|
@ -611,8 +609,8 @@ All of the ``kwargs`` dictionary is passed directly to the form field's
|
||||||
:meth:`~django.forms.Field__init__` method. Normally, all you need to do is
|
:meth:`~django.forms.Field__init__` method. Normally, all you need to do is
|
||||||
set up a good default for the ``form_class`` argument and then delegate further
|
set up a good default for the ``form_class`` argument and then delegate further
|
||||||
handling to the parent class. This might require you to write a custom form
|
handling to the parent class. This might require you to write a custom form
|
||||||
field (and even a form widget). See the :ref:`forms documentation
|
field (and even a form widget). See the :doc:`forms documentation
|
||||||
<topics-forms-index>` for information about this, and take a look at the code in
|
</topics/forms/index>` for information about this, and take a look at the code in
|
||||||
:mod:`django.contrib.localflavor` for some examples of custom widgets.
|
:mod:`django.contrib.localflavor` for some examples of custom widgets.
|
||||||
|
|
||||||
Continuing our ongoing example, we can write the :meth:`formfield` method as::
|
Continuing our ongoing example, we can write the :meth:`formfield` method as::
|
||||||
|
@ -721,7 +719,7 @@ Django provides a ``File`` class, which is used as a proxy to the file's
|
||||||
contents and operations. This can be subclassed to customize how the file is
|
contents and operations. This can be subclassed to customize how the file is
|
||||||
accessed, and what methods are available. It lives at
|
accessed, and what methods are available. It lives at
|
||||||
``django.db.models.fields.files``, and its default behavior is explained in the
|
``django.db.models.fields.files``, and its default behavior is explained in the
|
||||||
:ref:`file documentation <ref-files-file>`.
|
:doc:`file documentation </ref/files/file>`.
|
||||||
|
|
||||||
Once a subclass of ``File`` is created, the new ``FileField`` subclass must be
|
Once a subclass of ``File`` is created, the new ``FileField`` subclass must be
|
||||||
told to use it. To do so, simply assign the new ``File`` subclass to the special
|
told to use it. To do so, simply assign the new ``File`` subclass to the special
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-custom-template-tags:
|
|
||||||
|
|
||||||
================================
|
================================
|
||||||
Custom template tags and filters
|
Custom template tags and filters
|
||||||
================================
|
================================
|
||||||
|
@ -7,8 +5,8 @@ Custom template tags and filters
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
|
||||||
Django's template system comes with a wide variety of :ref:`built-in
|
Django's template system comes with a wide variety of :doc:`built-in
|
||||||
tags and filters <ref-templates-builtins>` designed to address the
|
tags and filters </ref/templates/builtins>` designed to address the
|
||||||
presentation logic needs of your application. Nevertheless, you may
|
presentation logic needs of your application. Nevertheless, you may
|
||||||
find yourself needing functionality that is not covered by the core
|
find yourself needing functionality that is not covered by the core
|
||||||
set of template primitives. You can extend the template engine by
|
set of template primitives. You can extend the template engine by
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
.. _howto-deployment-fastcgi:
|
|
||||||
|
|
||||||
============================================
|
============================================
|
||||||
How to use Django with FastCGI, SCGI, or AJP
|
How to use Django with FastCGI, SCGI, or AJP
|
||||||
============================================
|
============================================
|
||||||
|
|
||||||
.. highlight:: bash
|
.. highlight:: bash
|
||||||
|
|
||||||
Although the current preferred setup for running Django is :ref:`Apache with
|
Although the current preferred setup for running Django is :doc:`Apache with
|
||||||
mod_wsgi <howto-deployment-modwsgi>`, many people use shared hosting, on
|
mod_wsgi </howto/deployment/modwsgi>`, many people use shared hosting, on
|
||||||
which protocols such as FastCGI, SCGI or AJP are the only viable options. In
|
which protocols such as FastCGI, SCGI or AJP are the only viable options. In
|
||||||
some setups, these protocols may provide better performance than mod_wsgi_.
|
some setups, these protocols may provide better performance than mod_wsgi_.
|
||||||
|
|
||||||
|
@ -74,7 +72,7 @@ TCP socket. What you choose is a manner of preference; a TCP socket is usually
|
||||||
easier due to permissions issues.
|
easier due to permissions issues.
|
||||||
|
|
||||||
To start your server, first change into the directory of your project (wherever
|
To start your server, first change into the directory of your project (wherever
|
||||||
your :ref:`manage.py <ref-django-admin>` is), and then run the
|
your :doc:`manage.py </ref/django-admin>` is), and then run the
|
||||||
:djadmin:`runfcgi` command::
|
:djadmin:`runfcgi` command::
|
||||||
|
|
||||||
./manage.py runfcgi [options]
|
./manage.py runfcgi [options]
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-deployment-index:
|
|
||||||
|
|
||||||
Deploying Django
|
Deploying Django
|
||||||
================
|
================
|
||||||
|
|
||||||
|
@ -16,7 +14,7 @@ ways to easily deploy Django:
|
||||||
fastcgi
|
fastcgi
|
||||||
|
|
||||||
If you're new to deploying Django and/or Python, we'd recommend you try
|
If you're new to deploying Django and/or Python, we'd recommend you try
|
||||||
:ref:`mod_wsgi <howto-deployment-modwsgi>` first. In most cases it'll be the easiest,
|
:doc:`mod_wsgi </howto/deployment/modwsgi>` first. In most cases it'll be the easiest,
|
||||||
fastest, and most stable deployment choice.
|
fastest, and most stable deployment choice.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-deployment-modpython:
|
|
||||||
|
|
||||||
============================================
|
============================================
|
||||||
How to use Django with Apache and mod_python
|
How to use Django with Apache and mod_python
|
||||||
============================================
|
============================================
|
||||||
|
@ -8,7 +6,7 @@ How to use Django with Apache and mod_python
|
||||||
|
|
||||||
The `mod_python`_ module for Apache_ can be used to deploy Django to a
|
The `mod_python`_ module for Apache_ can be used to deploy Django to a
|
||||||
production server, although it has been mostly superseded by the simpler
|
production server, although it has been mostly superseded by the simpler
|
||||||
:ref:`mod_wsgi deployment option <howto-deployment-modwsgi>`.
|
:doc:`mod_wsgi deployment option </howto/deployment/modwsgi>`.
|
||||||
|
|
||||||
mod_python is similar to (and inspired by) `mod_perl`_ : It embeds Python within
|
mod_python is similar to (and inspired by) `mod_perl`_ : It embeds Python within
|
||||||
Apache and loads Python code into memory when the server starts. Code stays in
|
Apache and loads Python code into memory when the server starts. Code stays in
|
||||||
|
@ -25,8 +23,8 @@ Django requires Apache 2.x and mod_python 3.x, and you should use Apache's
|
||||||
Apache, there's no better source than `Apache's own official
|
Apache, there's no better source than `Apache's own official
|
||||||
documentation`_
|
documentation`_
|
||||||
|
|
||||||
* You may also be interested in :ref:`How to use Django with FastCGI, SCGI,
|
* You may also be interested in :doc:`How to use Django with FastCGI, SCGI,
|
||||||
or AJP <howto-deployment-fastcgi>`.
|
or AJP </howto/deployment/fastcgi>`.
|
||||||
|
|
||||||
.. _Apache: http://httpd.apache.org/
|
.. _Apache: http://httpd.apache.org/
|
||||||
.. _mod_python: http://www.modpython.org/
|
.. _mod_python: http://www.modpython.org/
|
||||||
|
@ -383,7 +381,7 @@ If you get a UnicodeEncodeError
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
If you're taking advantage of the internationalization features of Django (see
|
If you're taking advantage of the internationalization features of Django (see
|
||||||
:ref:`topics-i18n`) and you intend to allow users to upload files, you must
|
:doc:`/topics/i18n/index`) and you intend to allow users to upload files, you must
|
||||||
ensure that the environment used to start Apache is configured to accept
|
ensure that the environment used to start Apache is configured to accept
|
||||||
non-ASCII file names. If your environment is not correctly configured, you
|
non-ASCII file names. If your environment is not correctly configured, you
|
||||||
will trigger ``UnicodeEncodeError`` exceptions when calling functions like
|
will trigger ``UnicodeEncodeError`` exceptions when calling functions like
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-deployment-modwsgi:
|
|
||||||
|
|
||||||
==========================================
|
==========================================
|
||||||
How to use Django with Apache and mod_wsgi
|
How to use Django with Apache and mod_wsgi
|
||||||
==========================================
|
==========================================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-error-reporting:
|
|
||||||
|
|
||||||
Error reporting via e-mail
|
Error reporting via e-mail
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
|
@ -30,8 +28,8 @@ the HTTP request that caused the error.
|
||||||
to specify :setting:`EMAIL_HOST` and possibly
|
to specify :setting:`EMAIL_HOST` and possibly
|
||||||
:setting:`EMAIL_HOST_USER` and :setting:`EMAIL_HOST_PASSWORD`,
|
:setting:`EMAIL_HOST_USER` and :setting:`EMAIL_HOST_PASSWORD`,
|
||||||
though other settings may be also required depending on your mail
|
though other settings may be also required depending on your mail
|
||||||
server's configuration. Consult :ref:`the Django settings
|
server's configuration. Consult :doc:`the Django settings
|
||||||
documentation <ref-settings>` for a full list of email-related
|
documentation </ref/settings>` for a full list of email-related
|
||||||
settings.
|
settings.
|
||||||
|
|
||||||
By default, Django will send email from root@localhost. However, some mail
|
By default, Django will send email from root@localhost. However, some mail
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-i18n:
|
|
||||||
|
|
||||||
.. _using-translations-in-your-own-projects:
|
.. _using-translations-in-your-own-projects:
|
||||||
|
|
||||||
===============================================
|
===============================================
|
||||||
|
@ -46,7 +44,7 @@ To create message files, you use the :djadmin:`django-admin.py makemessages <mak
|
||||||
tool. You only need to be in the same directory where the ``locale/`` directory
|
tool. You only need to be in the same directory where the ``locale/`` directory
|
||||||
is located. And you use :djadmin:`django-admin.py compilemessages <compilemessages>`
|
is located. And you use :djadmin:`django-admin.py compilemessages <compilemessages>`
|
||||||
to produce the binary ``.mo`` files that are used by ``gettext``. Read the
|
to produce the binary ``.mo`` files that are used by ``gettext``. Read the
|
||||||
:ref:`topics-i18n-localization` document for more details.
|
:doc:`/topics/i18n/localization` document for more details.
|
||||||
|
|
||||||
You can also run ``django-admin.py compilemessages --settings=path.to.settings``
|
You can also run ``django-admin.py compilemessages --settings=path.to.settings``
|
||||||
to make the compiler process all the directories in your :setting:`LOCALE_PATHS`
|
to make the compiler process all the directories in your :setting:`LOCALE_PATHS`
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
.. _howto-index:
|
|
||||||
|
|
||||||
"How-to" guides
|
"How-to" guides
|
||||||
===============
|
===============
|
||||||
|
|
||||||
Here you'll find short answers to "How do I....?" types of questions. These
|
Here you'll find short answers to "How do I....?" types of questions. These
|
||||||
how-to guides don't cover topics in depth -- you'll find that material in the
|
how-to guides don't cover topics in depth -- you'll find that material in the
|
||||||
:ref:`topics-index` and the :ref:`ref-index`. However, these guides will help
|
:doc:`/topics/index` and the :doc:`/ref/index`. However, these guides will help
|
||||||
you quickly accomplish common tasks.
|
you quickly accomplish common tasks.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-initial-data:
|
|
||||||
|
|
||||||
=================================
|
=================================
|
||||||
Providing initial data for models
|
Providing initial data for models
|
||||||
=================================
|
=================================
|
||||||
|
@ -20,10 +18,10 @@ Providing initial data with fixtures
|
||||||
|
|
||||||
A fixture is a collection of data that Django knows how to import into a
|
A fixture is a collection of data that Django knows how to import into a
|
||||||
database. The most straightforward way of creating a fixture if you've already
|
database. The most straightforward way of creating a fixture if you've already
|
||||||
got some data is to use the :djadmin:`manage.py dumpdata` command. Or, you can
|
got some data is to use the :djadmin:`manage.py dumpdata <dumpdata>` command.
|
||||||
write fixtures by hand; fixtures can be written as XML, YAML, or JSON documents.
|
Or, you can write fixtures by hand; fixtures can be written as XML, YAML, or
|
||||||
The :ref:`serialization documentation <topics-serialization>` has more details
|
JSON documents. The :doc:`serialization documentation </topics/serialization>`
|
||||||
about each of these supported :ref:`serialization formats
|
has more details about each of these supported :ref:`serialization formats
|
||||||
<serialization-formats>`.
|
<serialization-formats>`.
|
||||||
|
|
||||||
As an example, though, here's what a fixture for a simple ``Person`` model might
|
As an example, though, here's what a fixture for a simple ``Person`` model might
|
||||||
|
@ -114,9 +112,9 @@ which will insert the desired data (e.g., properly-formatted
|
||||||
``INSERT`` statements separated by semicolons).
|
``INSERT`` statements separated by semicolons).
|
||||||
|
|
||||||
The SQL files are read by the :djadmin:`sqlcustom`, :djadmin:`sqlreset`,
|
The SQL files are read by the :djadmin:`sqlcustom`, :djadmin:`sqlreset`,
|
||||||
:djadmin:`sqlall` and :djadmin:`reset` commands in :ref:`manage.py
|
:djadmin:`sqlall` and :djadmin:`reset` commands in :doc:`manage.py
|
||||||
<ref-django-admin>`. Refer to the :ref:`manage.py documentation
|
</ref/django-admin>`. Refer to the :doc:`manage.py documentation
|
||||||
<ref-django-admin>` for more information.
|
</ref/django-admin>` for more information.
|
||||||
|
|
||||||
Note that if you have multiple SQL data files, there's no guarantee of
|
Note that if you have multiple SQL data files, there's no guarantee of
|
||||||
the order in which they're executed. The only thing you can assume is
|
the order in which they're executed. The only thing you can assume is
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-jython:
|
|
||||||
|
|
||||||
========================
|
========================
|
||||||
Running Django on Jython
|
Running Django on Jython
|
||||||
========================
|
========================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-legacy-databases:
|
|
||||||
|
|
||||||
=========================================
|
=========================================
|
||||||
Integrating Django with a legacy database
|
Integrating Django with a legacy database
|
||||||
=========================================
|
=========================================
|
||||||
|
@ -9,7 +7,7 @@ possible to integrate it into legacy databases. Django includes a couple of
|
||||||
utilities to automate as much of this process as possible.
|
utilities to automate as much of this process as possible.
|
||||||
|
|
||||||
This document assumes you know the Django basics, as covered in the
|
This document assumes you know the Django basics, as covered in the
|
||||||
:ref:`tutorial <intro-tutorial01>`.
|
:doc:`tutorial </intro/tutorial01>`.
|
||||||
|
|
||||||
Once you've got Django set up, you'll follow this general process to integrate
|
Once you've got Django set up, you'll follow this general process to integrate
|
||||||
with an existing database.
|
with an existing database.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-outputting-csv:
|
|
||||||
|
|
||||||
==========================
|
==========================
|
||||||
Outputting CSV with Django
|
Outputting CSV with Django
|
||||||
==========================
|
==========================
|
||||||
|
@ -61,7 +59,7 @@ mention:
|
||||||
Using the template system
|
Using the template system
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
Alternatively, you can use the :ref:`Django template system <topics-templates>`
|
Alternatively, you can use the :doc:`Django template system </topics/templates>`
|
||||||
to generate CSV. This is lower-level than using the convenient CSV, but the
|
to generate CSV. This is lower-level than using the convenient CSV, but the
|
||||||
solution is presented here for completeness.
|
solution is presented here for completeness.
|
||||||
|
|
||||||
|
@ -113,4 +111,4 @@ Other text-based formats
|
||||||
Notice that there isn't very much specific to CSV here -- just the specific
|
Notice that there isn't very much specific to CSV here -- just the specific
|
||||||
output format. You can use either of these techniques to output any text-based
|
output format. You can use either of these techniques to output any text-based
|
||||||
format you can dream of. You can also use a similar technique to generate
|
format you can dream of. You can also use a similar technique to generate
|
||||||
arbitrary binary data; see :ref:`howto-outputting-pdf` for an example.
|
arbitrary binary data; see :doc:`/howto/outputting-pdf` for an example.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-outputting-pdf:
|
|
||||||
|
|
||||||
===========================
|
===========================
|
||||||
Outputting PDFs with Django
|
Outputting PDFs with Django
|
||||||
===========================
|
===========================
|
||||||
|
@ -154,5 +152,5 @@ Other formats
|
||||||
Notice that there isn't a lot in these examples that's PDF-specific -- just the
|
Notice that there isn't a lot in these examples that's PDF-specific -- just the
|
||||||
bits using ``reportlab``. You can use a similar technique to generate any
|
bits using ``reportlab``. You can use a similar technique to generate any
|
||||||
arbitrary format that you can find a Python library for. Also see
|
arbitrary format that you can find a Python library for. Also see
|
||||||
:ref:`howto-outputting-csv` for another example and some techniques you can use
|
:doc:`/howto/outputting-csv` for another example and some techniques you can use
|
||||||
when generated text-based formats.
|
when generated text-based formats.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _howto-static-files:
|
|
||||||
|
|
||||||
=========================
|
=========================
|
||||||
How to serve static files
|
How to serve static files
|
||||||
=========================
|
=========================
|
||||||
|
@ -42,7 +40,7 @@ Here's the formal definition of the :func:`~django.views.static.serve` view:
|
||||||
|
|
||||||
.. function:: def serve(request, path, document_root, show_indexes=False)
|
.. function:: def serve(request, path, document_root, show_indexes=False)
|
||||||
|
|
||||||
To use it, just put this in your :ref:`URLconf <topics-http-urls>`::
|
To use it, just put this in your :doc:`URLconf </topics/http/urls>`::
|
||||||
|
|
||||||
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
|
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
|
||||||
{'document_root': '/path/to/media'}),
|
{'document_root': '/path/to/media'}),
|
||||||
|
@ -71,7 +69,7 @@ required. For example, if we have a line in ``settings.py`` that says::
|
||||||
|
|
||||||
STATIC_DOC_ROOT = '/path/to/media'
|
STATIC_DOC_ROOT = '/path/to/media'
|
||||||
|
|
||||||
...we could write the above :ref:`URLconf <topics-http-urls>` entry as::
|
...we could write the above :doc:`URLconf </topics/http/urls>` entry as::
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
...
|
...
|
||||||
|
|
208
docs/index.txt
208
docs/index.txt
|
@ -12,10 +12,10 @@ Getting help
|
||||||
|
|
||||||
Having trouble? We'd like to help!
|
Having trouble? We'd like to help!
|
||||||
|
|
||||||
* Try the :ref:`FAQ <faq-index>` -- it's got answers to many common questions.
|
* Try the :doc:`FAQ <faq/index>` -- it's got answers to many common questions.
|
||||||
|
|
||||||
* Looking for specific information? Try the :ref:`genindex`, :ref:`modindex` or
|
* Looking for specific information? Try the :ref:`genindex`, :ref:`modindex` or
|
||||||
the :ref:`detailed table of contents <contents>`.
|
the :doc:`detailed table of contents <contents>`.
|
||||||
|
|
||||||
* Search for information in the `archives of the django-users mailing list`_, or
|
* Search for information in the `archives of the django-users mailing list`_, or
|
||||||
`post a question`_.
|
`post a question`_.
|
||||||
|
@ -35,179 +35,179 @@ First steps
|
||||||
===========
|
===========
|
||||||
|
|
||||||
* **From scratch:**
|
* **From scratch:**
|
||||||
:ref:`Overview <intro-overview>` |
|
:doc:`Overview <intro/overview>` |
|
||||||
:ref:`Installation <intro-install>`
|
:doc:`Installation <intro/install>`
|
||||||
|
|
||||||
* **Tutorial:**
|
* **Tutorial:**
|
||||||
:ref:`Part 1 <intro-tutorial01>` |
|
:doc:`Part 1 <intro/tutorial01>` |
|
||||||
:ref:`Part 2 <intro-tutorial02>` |
|
:doc:`Part 2 <intro/tutorial02>` |
|
||||||
:ref:`Part 3 <intro-tutorial03>` |
|
:doc:`Part 3 <intro/tutorial03>` |
|
||||||
:ref:`Part 4 <intro-tutorial04>`
|
:doc:`Part 4 <intro/tutorial04>`
|
||||||
|
|
||||||
The model layer
|
The model layer
|
||||||
===============
|
===============
|
||||||
|
|
||||||
* **Models:**
|
* **Models:**
|
||||||
:ref:`Model syntax <topics-db-models>` |
|
:doc:`Model syntax <topics/db/models>` |
|
||||||
:ref:`Field types <ref-models-fields>` |
|
:doc:`Field types <ref/models/fields>` |
|
||||||
:ref:`Meta options <ref-models-options>`
|
:doc:`Meta options <ref/models/options>`
|
||||||
|
|
||||||
* **QuerySets:**
|
* **QuerySets:**
|
||||||
:ref:`Executing queries <topics-db-queries>` |
|
:doc:`Executing queries <topics/db/queries>` |
|
||||||
:ref:`QuerySet method reference <ref-models-querysets>`
|
:doc:`QuerySet method reference <ref/models/querysets>`
|
||||||
|
|
||||||
* **Model instances:**
|
* **Model instances:**
|
||||||
:ref:`Instance methods <ref-models-instances>` |
|
:doc:`Instance methods <ref/models/instances>` |
|
||||||
:ref:`Accessing related objects <ref-models-relations>`
|
:doc:`Accessing related objects <ref/models/relations>`
|
||||||
|
|
||||||
* **Advanced:**
|
* **Advanced:**
|
||||||
:ref:`Managers <topics-db-managers>` |
|
:doc:`Managers <topics/db/managers>` |
|
||||||
:ref:`Raw SQL <topics-db-sql>` |
|
:doc:`Raw SQL <topics/db/sql>` |
|
||||||
:ref:`Transactions <topics-db-transactions>` |
|
:doc:`Transactions <topics/db/transactions>` |
|
||||||
:ref:`Aggregation <topics-db-aggregation>` |
|
:doc:`Aggregation <topics/db/aggregation>` |
|
||||||
:ref:`Custom fields <howto-custom-model-fields>` |
|
:doc:`Custom fields <howto/custom-model-fields>` |
|
||||||
:ref:`Multiple databases <topics-db-multi-db>`
|
:doc:`Multiple databases <topics/db/multi-db>`
|
||||||
|
|
||||||
* **Other:**
|
* **Other:**
|
||||||
:ref:`Supported databases <ref-databases>` |
|
:doc:`Supported databases <ref/databases>` |
|
||||||
:ref:`Legacy databases <howto-legacy-databases>` |
|
:doc:`Legacy databases <howto/legacy-databases>` |
|
||||||
:ref:`Providing initial data <howto-initial-data>` |
|
:doc:`Providing initial data <howto/initial-data>` |
|
||||||
:ref:`Optimize database access <topics-db-optimization>`
|
:doc:`Optimize database access <topics/db/optimization>`
|
||||||
|
|
||||||
The template layer
|
The template layer
|
||||||
==================
|
==================
|
||||||
|
|
||||||
* **For designers:**
|
* **For designers:**
|
||||||
:ref:`Syntax overview <topics-templates>` |
|
:doc:`Syntax overview <topics/templates>` |
|
||||||
:ref:`Built-in tags and filters <ref-templates-builtins>`
|
:doc:`Built-in tags and filters <ref/templates/builtins>`
|
||||||
|
|
||||||
* **For programmers:**
|
* **For programmers:**
|
||||||
:ref:`Template API <ref-templates-api>` |
|
:doc:`Template API <ref/templates/api>` |
|
||||||
:ref:`Custom tags and filters <howto-custom-template-tags>`
|
:doc:`Custom tags and filters <howto/custom-template-tags>`
|
||||||
|
|
||||||
The view layer
|
The view layer
|
||||||
==============
|
==============
|
||||||
|
|
||||||
* **The basics:**
|
* **The basics:**
|
||||||
:ref:`URLconfs <topics-http-urls>` |
|
:doc:`URLconfs <topics/http/urls>` |
|
||||||
:ref:`View functions <topics-http-views>` |
|
:doc:`View functions <topics/http/views>` |
|
||||||
:ref:`Shortcuts <topics-http-shortcuts>`
|
:doc:`Shortcuts <topics/http/shortcuts>`
|
||||||
|
|
||||||
* **Reference:** :ref:`Request/response objects <ref-request-response>`
|
* **Reference:** :doc:`Request/response objects <ref/request-response>`
|
||||||
|
|
||||||
* **File uploads:**
|
* **File uploads:**
|
||||||
:ref:`Overview <topics-http-file-uploads>` |
|
:doc:`Overview <topics/http/file-uploads>` |
|
||||||
:ref:`File objects <ref-files-file>` |
|
:doc:`File objects <ref/files/file>` |
|
||||||
:ref:`Storage API <ref-files-storage>` |
|
:doc:`Storage API <ref/files/storage>` |
|
||||||
:ref:`Managing files <topics-files>` |
|
:doc:`Managing files <topics/files>` |
|
||||||
:ref:`Custom storage <howto-custom-file-storage>`
|
:doc:`Custom storage <howto/custom-file-storage>`
|
||||||
|
|
||||||
* **Generic views:**
|
* **Generic views:**
|
||||||
:ref:`Overview<topics-generic-views>` |
|
:doc:`Overview<topics/generic-views>` |
|
||||||
:ref:`Built-in generic views<ref-generic-views>`
|
:doc:`Built-in generic views<ref/generic-views>`
|
||||||
|
|
||||||
* **Advanced:**
|
* **Advanced:**
|
||||||
:ref:`Generating CSV <howto-outputting-csv>` |
|
:doc:`Generating CSV <howto/outputting-csv>` |
|
||||||
:ref:`Generating PDF <howto-outputting-pdf>`
|
:doc:`Generating PDF <howto/outputting-pdf>`
|
||||||
|
|
||||||
* **Middleware:**
|
* **Middleware:**
|
||||||
:ref:`Overview <topics-http-middleware>` |
|
:doc:`Overview <topics/http/middleware>` |
|
||||||
:ref:`Built-in middleware classes <ref-middleware>`
|
:doc:`Built-in middleware classes <ref/middleware>`
|
||||||
|
|
||||||
Forms
|
Forms
|
||||||
=====
|
=====
|
||||||
|
|
||||||
* **The basics:**
|
* **The basics:**
|
||||||
:ref:`Overview <topics-forms-index>` |
|
:doc:`Overview <topics/forms/index>` |
|
||||||
:ref:`Form API <ref-forms-api>` |
|
:doc:`Form API <ref/forms/api>` |
|
||||||
:ref:`Built-in fields <ref-forms-fields>` |
|
:doc:`Built-in fields <ref/forms/fields>` |
|
||||||
:ref:`Built-in widgets <ref-forms-widgets>`
|
:doc:`Built-in widgets <ref/forms/widgets>`
|
||||||
|
|
||||||
* **Advanced:**
|
* **Advanced:**
|
||||||
:ref:`Forms for models <topics-forms-modelforms>` |
|
:doc:`Forms for models <topics/forms/modelforms>` |
|
||||||
:ref:`Integrating media <topics-forms-media>` |
|
:doc:`Integrating media <topics/forms/media>` |
|
||||||
:ref:`Formsets <topics-forms-formsets>` |
|
:doc:`Formsets <topics/forms/formsets>` |
|
||||||
:ref:`Customizing validation <ref-forms-validation>`
|
:doc:`Customizing validation <ref/forms/validation>`
|
||||||
|
|
||||||
* **Extras:**
|
* **Extras:**
|
||||||
:ref:`Form preview <ref-contrib-formtools-form-preview>` |
|
:doc:`Form preview <ref/contrib/formtools/form-preview>` |
|
||||||
:ref:`Form wizard <ref-contrib-formtools-form-wizard>`
|
:doc:`Form wizard <ref/contrib/formtools/form-wizard>`
|
||||||
|
|
||||||
The development process
|
The development process
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
* **Settings:**
|
* **Settings:**
|
||||||
:ref:`Overview <topics-settings>` |
|
:doc:`Overview <topics/settings>` |
|
||||||
:ref:`Full list of settings <ref-settings>`
|
:doc:`Full list of settings <ref/settings>`
|
||||||
|
|
||||||
* **Exceptions:**
|
* **Exceptions:**
|
||||||
:ref:`Overview <ref-exceptions>`
|
:doc:`Overview <ref/exceptions>`
|
||||||
|
|
||||||
* **django-admin.py and manage.py:**
|
* **django-admin.py and manage.py:**
|
||||||
:ref:`Overview <ref-django-admin>` |
|
:doc:`Overview <ref/django-admin>` |
|
||||||
:ref:`Adding custom commands <howto-custom-management-commands>`
|
:doc:`Adding custom commands <howto/custom-management-commands>`
|
||||||
|
|
||||||
* **Testing:** :ref:`Overview <topics-testing>`
|
* **Testing:** :doc:`Overview <topics/testing>`
|
||||||
|
|
||||||
* **Deployment:**
|
* **Deployment:**
|
||||||
:ref:`Overview <howto-deployment-index>` |
|
:doc:`Overview <howto/deployment/index>` |
|
||||||
:ref:`Apache/mod_wsgi <howto-deployment-modwsgi>` |
|
:doc:`Apache/mod_wsgi <howto/deployment/modwsgi>` |
|
||||||
:ref:`Apache/mod_python <howto-deployment-modpython>` |
|
:doc:`Apache/mod_python <howto/deployment/modpython>` |
|
||||||
:ref:`FastCGI/SCGI/AJP <howto-deployment-fastcgi>` |
|
:doc:`FastCGI/SCGI/AJP <howto/deployment/fastcgi>` |
|
||||||
:ref:`Apache authentication <howto-apache-auth>` |
|
:doc:`Apache authentication <howto/apache-auth>` |
|
||||||
:ref:`Serving static files <howto-static-files>` |
|
:doc:`Serving static files <howto/static-files>` |
|
||||||
:ref:`Tracking code errors by e-mail <howto-error-reporting>`
|
:doc:`Tracking code errors by e-mail <howto/error-reporting>`
|
||||||
|
|
||||||
Other batteries included
|
Other batteries included
|
||||||
========================
|
========================
|
||||||
|
|
||||||
* :ref:`Admin site <ref-contrib-admin>` | :ref:`Admin actions <ref-contrib-admin-actions>`
|
* :doc:`Admin site <ref/contrib/admin/index>` | :doc:`Admin actions <ref/contrib/admin/actions>`
|
||||||
* :ref:`Authentication <topics-auth>`
|
* :doc:`Authentication <topics/auth>`
|
||||||
* :ref:`Cache system <topics-cache>`
|
* :doc:`Cache system <topics/cache>`
|
||||||
* :ref:`Conditional content processing <topics-conditional-processing>`
|
* :doc:`Conditional content processing <topics/conditional-view-processing>`
|
||||||
* :ref:`Comments <ref-contrib-comments-index>` | :ref:`Moderation <ref-contrib-comments-moderation>` | :ref:`Custom comments <ref-contrib-comments-custom>`
|
* :doc:`Comments <ref/contrib/comments/index>` | :doc:`Moderation <ref/contrib/comments/moderation>` | :doc:`Custom comments <ref/contrib/comments/custom>`
|
||||||
* :ref:`Content types <ref-contrib-contenttypes>`
|
* :doc:`Content types <ref/contrib/contenttypes>`
|
||||||
* :ref:`Cross Site Request Forgery protection <ref-contrib-csrf>`
|
* :doc:`Cross Site Request Forgery protection <ref/contrib/csrf>`
|
||||||
* :ref:`Databrowse <ref-contrib-databrowse>`
|
* :doc:`Databrowse <ref/contrib/databrowse>`
|
||||||
* :ref:`E-mail (sending) <topics-email>`
|
* :doc:`E-mail (sending) <topics/email>`
|
||||||
* :ref:`Flatpages <ref-contrib-flatpages>`
|
* :doc:`Flatpages <ref/contrib/flatpages>`
|
||||||
* :ref:`GeoDjango <ref-contrib-gis>`
|
* :doc:`GeoDjango <ref/contrib/gis/index>`
|
||||||
* :ref:`Humanize <ref-contrib-humanize>`
|
* :doc:`Humanize <ref/contrib/humanize>`
|
||||||
* :ref:`Internationalization <topics-i18n>`
|
* :doc:`Internationalization <topics/i18n/index>`
|
||||||
* :ref:`Jython support <howto-jython>`
|
* :doc:`Jython support <howto/jython>`
|
||||||
* :ref:`"Local flavor" <ref-contrib-localflavor>`
|
* :doc:`"Local flavor" <ref/contrib/localflavor>`
|
||||||
* :ref:`Messages <ref-contrib-messages>`
|
* :doc:`Messages <ref/contrib/messages>`
|
||||||
* :ref:`Pagination <topics-pagination>`
|
* :doc:`Pagination <topics/pagination>`
|
||||||
* :ref:`Redirects <ref-contrib-redirects>`
|
* :doc:`Redirects <ref/contrib/redirects>`
|
||||||
* :ref:`Serialization <topics-serialization>`
|
* :doc:`Serialization <topics/serialization>`
|
||||||
* :ref:`Sessions <topics-http-sessions>`
|
* :doc:`Sessions <topics/http/sessions>`
|
||||||
* :ref:`Signals <topics-signals>`
|
* :doc:`Signals <topics/signals>`
|
||||||
* :ref:`Sitemaps <ref-contrib-sitemaps>`
|
* :doc:`Sitemaps <ref/contrib/sitemaps>`
|
||||||
* :ref:`Sites <ref-contrib-sites>`
|
* :doc:`Sites <ref/contrib/sites>`
|
||||||
* :ref:`Syndication feeds (RSS/Atom) <ref-contrib-syndication>`
|
* :doc:`Syndication feeds (RSS/Atom) <ref/contrib/syndication>`
|
||||||
* :ref:`Unicode in Django <ref-unicode>`
|
* :doc:`Unicode in Django <ref/unicode>`
|
||||||
* :ref:`Web design helpers <ref-contrib-webdesign>`
|
* :doc:`Web design helpers <ref/contrib/webdesign>`
|
||||||
* :ref:`Validators <ref-validators>`
|
* :doc:`Validators <ref/validators>`
|
||||||
|
|
||||||
The Django open-source project
|
The Django open-source project
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
* **Community:**
|
* **Community:**
|
||||||
:ref:`How to get involved <internals-contributing>` |
|
:doc:`How to get involved <internals/contributing>` |
|
||||||
:ref:`The release process <internals-release-process>` |
|
:doc:`The release process <internals/release-process>` |
|
||||||
:ref:`Team of committers <internals-committers>` |
|
:doc:`Team of committers <internals/committers>` |
|
||||||
:ref:`The Django source code repository <internals-svn>`
|
:doc:`The Django source code repository <internals/svn>`
|
||||||
|
|
||||||
* **Design philosophies:**
|
* **Design philosophies:**
|
||||||
:ref:`Overview <misc-design-philosophies>`
|
:doc:`Overview <misc/design-philosophies>`
|
||||||
|
|
||||||
* **Documentation:**
|
* **Documentation:**
|
||||||
:ref:`About this documentation <internals-documentation>`
|
:doc:`About this documentation <internals/documentation>`
|
||||||
|
|
||||||
* **Third-party distributions:**
|
* **Third-party distributions:**
|
||||||
:ref:`Overview <misc-distributions>`
|
:doc:`Overview <misc/distributions>`
|
||||||
|
|
||||||
* **Django over time:**
|
* **Django over time:**
|
||||||
:ref:`API stability <misc-api-stability>` |
|
:doc:`API stability <misc/api-stability>` |
|
||||||
:ref:`Release notes and upgrading instructions <releases-index>` |
|
:doc:`Release notes and upgrading instructions <releases/index>` |
|
||||||
:ref:`Deprecation Timeline <internals-deprecation>`
|
:doc:`Deprecation Timeline <internals/deprecation>`
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _internals-committers:
|
|
||||||
|
|
||||||
=================
|
=================
|
||||||
Django committers
|
Django committers
|
||||||
=================
|
=================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _internals-contributing:
|
|
||||||
|
|
||||||
======================
|
======================
|
||||||
Contributing to Django
|
Contributing to Django
|
||||||
======================
|
======================
|
||||||
|
@ -42,7 +40,7 @@ amount of overhead involved in working with any bug tracking system, so your
|
||||||
help in keeping our ticket tracker as useful as possible is appreciated. In
|
help in keeping our ticket tracker as useful as possible is appreciated. In
|
||||||
particular:
|
particular:
|
||||||
|
|
||||||
* **Do** read the :ref:`FAQ <faq-index>` to see if your issue might be a well-known question.
|
* **Do** read the :doc:`FAQ </faq/index>` to see if your issue might be a well-known question.
|
||||||
|
|
||||||
* **Do** `search the tracker`_ to see if your issue has already been filed.
|
* **Do** `search the tracker`_ to see if your issue has already been filed.
|
||||||
|
|
||||||
|
@ -398,7 +396,7 @@ Various parts of Django, such as the admin site and validation error messages,
|
||||||
are internationalized. This means they display different text depending on a
|
are internationalized. This means they display different text depending on a
|
||||||
user's language setting. For this, Django uses the same internationalization
|
user's language setting. For this, Django uses the same internationalization
|
||||||
infrastructure available to Django applications described in the
|
infrastructure available to Django applications described in the
|
||||||
:ref:`i18n documentation<topics-i18n>`.
|
:doc:`i18n documentation</topics/i18n/index>`.
|
||||||
|
|
||||||
These translations are contributed by Django users worldwide. If you find an
|
These translations are contributed by Django users worldwide. If you find an
|
||||||
incorrect translation, or if you'd like to add a language that isn't yet
|
incorrect translation, or if you'd like to add a language that isn't yet
|
||||||
|
@ -409,7 +407,7 @@ translated, here's what to do:
|
||||||
* Make sure you read the notes about :ref:`specialties-of-django-i18n`.
|
* Make sure you read the notes about :ref:`specialties-of-django-i18n`.
|
||||||
|
|
||||||
* Create translations using the methods described in the
|
* Create translations using the methods described in the
|
||||||
:ref:`localization documentation <topics-i18n-localization>`. For this
|
:doc:`localization documentation </topics/i18n/localization>`. For this
|
||||||
you will use the ``django-admin.py makemessages`` tool. In this
|
you will use the ``django-admin.py makemessages`` tool. In this
|
||||||
particular case it should be run from the top-level ``django`` directory
|
particular case it should be run from the top-level ``django`` directory
|
||||||
of the Django source tree.
|
of the Django source tree.
|
||||||
|
@ -535,8 +533,8 @@ Please follow these coding standards when writing code for inclusion in Django:
|
||||||
* Use ``InitialCaps`` for class names (or for factory functions that
|
* Use ``InitialCaps`` for class names (or for factory functions that
|
||||||
return classes).
|
return classes).
|
||||||
|
|
||||||
* Mark all strings for internationalization; see the :ref:`i18n
|
* Mark all strings for internationalization; see the :doc:`i18n
|
||||||
documentation <topics-i18n>` for details.
|
documentation </topics/i18n/index>` for details.
|
||||||
|
|
||||||
* In docstrings, use "action words" such as::
|
* In docstrings, use "action words" such as::
|
||||||
|
|
||||||
|
@ -698,8 +696,8 @@ General improvements, or other changes to the APIs that should be emphasized
|
||||||
should use the ".. versionchanged:: X.Y" directive (with the same format as the
|
should use the ".. versionchanged:: X.Y" directive (with the same format as the
|
||||||
``versionadded`` mentioned above.
|
``versionadded`` mentioned above.
|
||||||
|
|
||||||
There's a full page of information about the :ref:`Django documentation
|
There's a full page of information about the :doc:`Django documentation
|
||||||
system <internals-documentation>` that you should read prior to working on the
|
system </internals/documentation>` that you should read prior to working on the
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
Guidelines for ReST files
|
Guidelines for ReST files
|
||||||
|
@ -829,7 +827,7 @@ The tests cover:
|
||||||
We appreciate any and all contributions to the test suite!
|
We appreciate any and all contributions to the test suite!
|
||||||
|
|
||||||
The Django tests all use the testing infrastructure that ships with Django for
|
The Django tests all use the testing infrastructure that ships with Django for
|
||||||
testing applications. See :ref:`Testing Django applications <topics-testing>`
|
testing applications. See :doc:`Testing Django applications </topics/testing>`
|
||||||
for an explanation of how to write new tests.
|
for an explanation of how to write new tests.
|
||||||
|
|
||||||
Running the unit tests
|
Running the unit tests
|
||||||
|
@ -1017,8 +1015,8 @@ for feature branches:
|
||||||
public, please add the branch to the `Django branches`_ wiki page.
|
public, please add the branch to the `Django branches`_ wiki page.
|
||||||
|
|
||||||
2. Feature branches using SVN have a higher bar. If you want a branch in SVN
|
2. Feature branches using SVN have a higher bar. If you want a branch in SVN
|
||||||
itself, you'll need a "mentor" among the :ref:`core committers
|
itself, you'll need a "mentor" among the :doc:`core committers
|
||||||
<internals-committers>`. This person is responsible for actually creating
|
</internals/committers>`. This person is responsible for actually creating
|
||||||
the branch, monitoring your process (see below), and ultimately merging
|
the branch, monitoring your process (see below), and ultimately merging
|
||||||
the branch into trunk.
|
the branch into trunk.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _internals-deprecation:
|
|
||||||
|
|
||||||
===========================
|
===========================
|
||||||
Django Deprecation Timeline
|
Django Deprecation Timeline
|
||||||
===========================
|
===========================
|
||||||
|
@ -52,7 +50,7 @@ their deprecation, as per the :ref:`Django deprecation policy
|
||||||
associated methods (``user.message_set.create()`` and
|
associated methods (``user.message_set.create()`` and
|
||||||
``user.get_and_delete_messages()``), which have
|
``user.get_and_delete_messages()``), which have
|
||||||
been deprecated since the 1.2 release, will be removed. The
|
been deprecated since the 1.2 release, will be removed. The
|
||||||
:ref:`messages framework <ref-contrib-messages>` should be used
|
:doc:`messages framework </ref/contrib/messages>` should be used
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
* Authentication backends need to support the ``obj`` parameter for
|
* Authentication backends need to support the ``obj`` parameter for
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _internals-documentation:
|
|
||||||
|
|
||||||
How the Django documentation works
|
How the Django documentation works
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
|
@ -88,27 +86,55 @@ __ http://sphinx.pocoo.org/markup/desc.html
|
||||||
An example
|
An example
|
||||||
----------
|
----------
|
||||||
|
|
||||||
For a quick example of how it all fits together, check this out:
|
For a quick example of how it all fits together, consider this hypothetical
|
||||||
|
example:
|
||||||
|
|
||||||
* First, the ``ref/settings.txt`` document starts out like this::
|
* First, the ``ref/settings.txt`` document could have an overall layout
|
||||||
|
like this:
|
||||||
|
|
||||||
.. _ref-settings:
|
.. code-block:: rst
|
||||||
|
|
||||||
|
========
|
||||||
|
Settings
|
||||||
|
========
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
.. _available-settings:
|
||||||
|
|
||||||
Available settings
|
Available settings
|
||||||
==================
|
==================
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
* Next, if you look at the ``topics/settings.txt`` document, you can see how
|
.. _deprecated-settings:
|
||||||
a link to ``ref/settings`` works::
|
|
||||||
|
|
||||||
Available settings
|
Deprecated settings
|
||||||
==================
|
===================
|
||||||
|
|
||||||
For a full list of available settings, see the :ref:`settings reference
|
...
|
||||||
<ref-settings>`.
|
|
||||||
|
|
||||||
* Next, notice how the settings (right now just the top few) are annotated::
|
* Next, the ``topics/settings.txt`` document could contain something like
|
||||||
|
this:
|
||||||
|
|
||||||
|
.. code-block:: rst
|
||||||
|
|
||||||
|
You can access a :ref:`listing of all available settings
|
||||||
|
<available-settings>`. For a list of deprecated settings see
|
||||||
|
:ref:`deprecated-settings`.
|
||||||
|
|
||||||
|
You can find both in the :doc:`settings reference document </ref/settings>`.
|
||||||
|
|
||||||
|
We use the Sphinx doc_ cross reference element when we want to link to
|
||||||
|
another document as a whole and the ref_ element when we want to link to
|
||||||
|
an arbitrary location in a document.
|
||||||
|
|
||||||
|
.. _doc: http://sphinx.pocoo.org/markup/inline.html#role-doc
|
||||||
|
.. _ref: http://sphinx.pocoo.org/markup/inline.html#role-ref
|
||||||
|
|
||||||
|
* Next, notice how the settings are annotated:
|
||||||
|
|
||||||
|
.. code-block:: rst
|
||||||
|
|
||||||
.. setting:: ADMIN_FOR
|
.. setting:: ADMIN_FOR
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _internals-index:
|
|
||||||
|
|
||||||
Django internals
|
Django internals
|
||||||
================
|
================
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _internals-release-process:
|
|
||||||
|
|
||||||
========================
|
========================
|
||||||
Django's release process
|
Django's release process
|
||||||
========================
|
========================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _internals-svn:
|
|
||||||
|
|
||||||
=================================
|
=================================
|
||||||
The Django source code repository
|
The Django source code repository
|
||||||
=================================
|
=================================
|
||||||
|
@ -87,8 +85,8 @@ the ``django`` module within your checkout.
|
||||||
|
|
||||||
If you're going to be working on Django's code (say, to fix a bug or
|
If you're going to be working on Django's code (say, to fix a bug or
|
||||||
develop a new feature), you can probably stop reading here and move
|
develop a new feature), you can probably stop reading here and move
|
||||||
over to :ref:`the documentation for contributing to Django
|
over to :doc:`the documentation for contributing to Django
|
||||||
<internals-contributing>`, which covers things like the preferred
|
</internals/contributing>`, which covers things like the preferred
|
||||||
coding style and how to generate and submit a patch.
|
coding style and how to generate and submit a patch.
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,20 +127,20 @@ part of Django itself, and so are no longer separately maintained:
|
||||||
object-relational mapper. This has been part of Django since the 1.0
|
object-relational mapper. This has been part of Django since the 1.0
|
||||||
release, as the bundled application ``django.contrib.gis``.
|
release, as the bundled application ``django.contrib.gis``.
|
||||||
|
|
||||||
* ``i18n``: Added :ref:`internationalization support <topics-i18n>` to
|
* ``i18n``: Added :doc:`internationalization support </topics/i18n/index>` to
|
||||||
Django. This has been part of Django since the 0.90 release.
|
Django. This has been part of Django since the 0.90 release.
|
||||||
|
|
||||||
* ``magic-removal``: A major refactoring of both the internals and
|
* ``magic-removal``: A major refactoring of both the internals and
|
||||||
public APIs of Django's object-relational mapper. This has been part
|
public APIs of Django's object-relational mapper. This has been part
|
||||||
of Django since the 0.95 release.
|
of Django since the 0.95 release.
|
||||||
|
|
||||||
* ``multi-auth``: A refactoring of :ref:`Django's bundled
|
* ``multi-auth``: A refactoring of :doc:`Django's bundled
|
||||||
authentication framework <topics-auth>` which added support for
|
authentication framework </topics/auth>` which added support for
|
||||||
:ref:`authentication backends <authentication-backends>`. This has
|
:ref:`authentication backends <authentication-backends>`. This has
|
||||||
been part of Django since the 0.95 release.
|
been part of Django since the 0.95 release.
|
||||||
|
|
||||||
* ``new-admin``: A refactoring of :ref:`Django's bundled
|
* ``new-admin``: A refactoring of :doc:`Django's bundled
|
||||||
administrative application <ref-contrib-admin>`. This became part of
|
administrative application </ref/contrib/admin/index>`. This became part of
|
||||||
Django as of the 0.91 release, but was superseded by another
|
Django as of the 0.91 release, but was superseded by another
|
||||||
refactoring (see next listing) prior to the Django 1.0 release.
|
refactoring (see next listing) prior to the Django 1.0 release.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _intro-index:
|
|
||||||
|
|
||||||
Getting started
|
Getting started
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
.. _intro-install:
|
|
||||||
|
|
||||||
Quick install guide
|
Quick install guide
|
||||||
===================
|
===================
|
||||||
|
|
||||||
Before you can use Django, you'll need to get it installed. We have a
|
Before you can use Django, you'll need to get it installed. We have a
|
||||||
:ref:`complete installation guide <topics-install>` that covers all the
|
:doc:`complete installation guide </topics/install>` that covers all the
|
||||||
possibilities; this guide will guide you to a simple, minimal installation
|
possibilities; this guide will guide you to a simple, minimal installation
|
||||||
that'll work while you walk through the introduction.
|
that'll work while you walk through the introduction.
|
||||||
|
|
||||||
|
@ -14,7 +12,7 @@ Install Python
|
||||||
Being a Python Web framework, Django requires Python. It works with any Python
|
Being a Python Web framework, Django requires Python. It works with any Python
|
||||||
version from 2.4 to 2.7 (due to backwards
|
version from 2.4 to 2.7 (due to backwards
|
||||||
incompatibilities in Python 3.0, Django does not currently work with
|
incompatibilities in Python 3.0, Django does not currently work with
|
||||||
Python 3.0; see :ref:`the Django FAQ <faq-install>` for more
|
Python 3.0; see :doc:`the Django FAQ </faq/install>` for more
|
||||||
information on supported Python versions and the 3.0 transition), but we recommend installing Python 2.5 or later. If you do so, you won't need to set up a database just yet: Python 2.5 or later includes a lightweight database called SQLite_.
|
information on supported Python versions and the 3.0 transition), but we recommend installing Python 2.5 or later. If you do so, you won't need to set up a database just yet: Python 2.5 or later includes a lightweight database called SQLite_.
|
||||||
|
|
||||||
.. _sqlite: http://sqlite.org/
|
.. _sqlite: http://sqlite.org/
|
||||||
|
@ -25,7 +23,7 @@ probably already have it installed.
|
||||||
.. admonition:: Django on Jython
|
.. admonition:: Django on Jython
|
||||||
|
|
||||||
If you use Jython_ (a Python implementation for the Java platform), you'll
|
If you use Jython_ (a Python implementation for the Java platform), you'll
|
||||||
need to follow a few additional steps. See :ref:`howto-jython` for details.
|
need to follow a few additional steps. See :doc:`/howto/jython` for details.
|
||||||
|
|
||||||
.. _jython: http://www.jython.org/
|
.. _jython: http://www.jython.org/
|
||||||
|
|
||||||
|
@ -57,8 +55,8 @@ Install Django
|
||||||
|
|
||||||
You've got three easy options to install Django:
|
You've got three easy options to install Django:
|
||||||
|
|
||||||
* Install a version of Django :ref:`provided by your operating system
|
* Install a version of Django :doc:`provided by your operating system
|
||||||
distribution <misc-distributions>`. This is the quickest option for those
|
distribution </misc/distributions>`. This is the quickest option for those
|
||||||
who have operating systems that distribute Django.
|
who have operating systems that distribute Django.
|
||||||
|
|
||||||
* :ref:`Install an official release <installing-official-release>`. This
|
* :ref:`Install an official release <installing-official-release>`. This
|
||||||
|
@ -79,7 +77,7 @@ You've got three easy options to install Django:
|
||||||
That's it!
|
That's it!
|
||||||
----------
|
----------
|
||||||
|
|
||||||
That's it -- you can now :ref:`move onto the tutorial <intro-tutorial01>`.
|
That's it -- you can now :doc:`move onto the tutorial </intro/tutorial01>`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _intro-overview:
|
|
||||||
|
|
||||||
==================
|
==================
|
||||||
Django at a glance
|
Django at a glance
|
||||||
==================
|
==================
|
||||||
|
@ -11,8 +9,8 @@ overview of how to write a database-driven Web app with Django.
|
||||||
The goal of this document is to give you enough technical specifics to
|
The goal of this document is to give you enough technical specifics to
|
||||||
understand how Django works, but this isn't intended to be a tutorial or
|
understand how Django works, but this isn't intended to be a tutorial or
|
||||||
reference -- but we've got both! When you're ready to start a project, you can
|
reference -- but we've got both! When you're ready to start a project, you can
|
||||||
:ref:`start with the tutorial <intro-tutorial01>` or :ref:`dive right into more
|
:doc:`start with the tutorial </intro/tutorial01>` or :doc:`dive right into more
|
||||||
detailed documentation <topics-index>`.
|
detailed documentation </topics/index>`.
|
||||||
|
|
||||||
Design your model
|
Design your model
|
||||||
=================
|
=================
|
||||||
|
@ -21,7 +19,7 @@ Although you can use Django without a database, it comes with an
|
||||||
object-relational mapper in which you describe your database layout in Python
|
object-relational mapper in which you describe your database layout in Python
|
||||||
code.
|
code.
|
||||||
|
|
||||||
The :ref:`data-model syntax <topics-db-models>` offers many rich ways of
|
The :doc:`data-model syntax </topics/db/models>` offers many rich ways of
|
||||||
representing your models -- so far, it's been solving two years' worth of
|
representing your models -- so far, it's been solving two years' worth of
|
||||||
database-schema problems. Here's a quick example::
|
database-schema problems. Here's a quick example::
|
||||||
|
|
||||||
|
@ -56,7 +54,7 @@ tables in your database for whichever tables don't already exist.
|
||||||
Enjoy the free API
|
Enjoy the free API
|
||||||
==================
|
==================
|
||||||
|
|
||||||
With that, you've got a free, and rich, :ref:`Python API <topics-db-queries>` to
|
With that, you've got a free, and rich, :doc:`Python API </topics/db/queries>` to
|
||||||
access your data. The API is created on the fly, no code generation necessary::
|
access your data. The API is created on the fly, no code generation necessary::
|
||||||
|
|
||||||
>>> from mysite.models import Reporter, Article
|
>>> from mysite.models import Reporter, Article
|
||||||
|
@ -131,7 +129,7 @@ A dynamic admin interface: it's not just scaffolding -- it's the whole house
|
||||||
============================================================================
|
============================================================================
|
||||||
|
|
||||||
Once your models are defined, Django can automatically create a professional,
|
Once your models are defined, Django can automatically create a professional,
|
||||||
production ready :ref:`administrative interface <ref-contrib-admin>` -- a Web
|
production ready :doc:`administrative interface </ref/contrib/admin/index>` -- a Web
|
||||||
site that lets authenticated users add, change and delete objects. It's as easy
|
site that lets authenticated users add, change and delete objects. It's as easy
|
||||||
as registering your model in the admin site::
|
as registering your model in the admin site::
|
||||||
|
|
||||||
|
@ -168,8 +166,8 @@ A clean, elegant URL scheme is an important detail in a high-quality Web
|
||||||
application. Django encourages beautiful URL design and doesn't put any cruft
|
application. Django encourages beautiful URL design and doesn't put any cruft
|
||||||
in URLs, like ``.php`` or ``.asp``.
|
in URLs, like ``.php`` or ``.asp``.
|
||||||
|
|
||||||
To design URLs for an app, you create a Python module called a :ref:`URLconf
|
To design URLs for an app, you create a Python module called a :doc:`URLconf
|
||||||
<topics-http-urls>`. A table of contents for your app, it contains a simple mapping
|
</topics/http/urls>`. A table of contents for your app, it contains a simple mapping
|
||||||
between URL patterns and Python callback functions. URLconfs also serve to
|
between URL patterns and Python callback functions. URLconfs also serve to
|
||||||
decouple URLs from Python code.
|
decouple URLs from Python code.
|
||||||
|
|
||||||
|
@ -216,7 +214,7 @@ and renders the template with the retrieved data. Here's an example view for
|
||||||
a_list = Article.objects.filter(pub_date__year=year)
|
a_list = Article.objects.filter(pub_date__year=year)
|
||||||
return render_to_response('news/year_archive.html', {'year': year, 'article_list': a_list})
|
return render_to_response('news/year_archive.html', {'year': year, 'article_list': a_list})
|
||||||
|
|
||||||
This example uses Django's :ref:`template system <topics-templates>`, which has
|
This example uses Django's :doc:`template system </topics/templates>`, which has
|
||||||
several powerful features but strives to stay simple enough for non-programmers
|
several powerful features but strives to stay simple enough for non-programmers
|
||||||
to use.
|
to use.
|
||||||
|
|
||||||
|
@ -307,17 +305,17 @@ This is just the surface
|
||||||
This has been only a quick overview of Django's functionality. Some more useful
|
This has been only a quick overview of Django's functionality. Some more useful
|
||||||
features:
|
features:
|
||||||
|
|
||||||
* A :ref:`caching framework <topics-cache>` that integrates with memcached
|
* A :doc:`caching framework </topics/cache>` that integrates with memcached
|
||||||
or other backends.
|
or other backends.
|
||||||
|
|
||||||
* A :ref:`syndication framework <ref-contrib-syndication>` that makes
|
* A :doc:`syndication framework </ref/contrib/syndication>` that makes
|
||||||
creating RSS and Atom feeds as easy as writing a small Python class.
|
creating RSS and Atom feeds as easy as writing a small Python class.
|
||||||
|
|
||||||
* More sexy automatically-generated admin features -- this overview barely
|
* More sexy automatically-generated admin features -- this overview barely
|
||||||
scratched the surface.
|
scratched the surface.
|
||||||
|
|
||||||
The next obvious steps are for you to `download Django`_, read :ref:`the
|
The next obvious steps are for you to `download Django`_, read :doc:`the
|
||||||
tutorial <intro-tutorial01>` and join `the community`_. Thanks for your
|
tutorial </intro/tutorial01>` and join `the community`_. Thanks for your
|
||||||
interest!
|
interest!
|
||||||
|
|
||||||
.. _download Django: http://www.djangoproject.com/download/
|
.. _download Django: http://www.djangoproject.com/download/
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _intro-tutorial01:
|
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Writing your first Django app, part 1
|
Writing your first Django app, part 1
|
||||||
=====================================
|
=====================================
|
||||||
|
@ -14,7 +12,7 @@ It'll consist of two parts:
|
||||||
* A public site that lets people view polls and vote in them.
|
* A public site that lets people view polls and vote in them.
|
||||||
* An admin site that lets you add, change and delete polls.
|
* An admin site that lets you add, change and delete polls.
|
||||||
|
|
||||||
We'll assume you have :ref:`Django installed <intro-install>` already. You can
|
We'll assume you have :doc:`Django installed </intro/install>` already. You can
|
||||||
tell Django is installed by running the Python interactive interpreter and
|
tell Django is installed by running the Python interactive interpreter and
|
||||||
typing ``import django``. If that command runs successfully, with no errors,
|
typing ``import django``. If that command runs successfully, with no errors,
|
||||||
Django is installed.
|
Django is installed.
|
||||||
|
@ -47,8 +45,8 @@ create a ``mysite`` directory in your current directory.
|
||||||
you try to run ``django-admin.py startproject``. This is because, on
|
you try to run ``django-admin.py startproject``. This is because, on
|
||||||
Unix-based systems like OS X, a file must be marked as "executable" before it
|
Unix-based systems like OS X, a file must be marked as "executable" before it
|
||||||
can be run as a program. To do this, open Terminal.app and navigate (using
|
can be run as a program. To do this, open Terminal.app and navigate (using
|
||||||
the ``cd`` command) to the directory where :ref:`django-admin.py
|
the ``cd`` command) to the directory where :doc:`django-admin.py
|
||||||
<ref-django-admin>` is installed, then run the command
|
</ref/django-admin>` is installed, then run the command
|
||||||
``chmod +x django-admin.py``.
|
``chmod +x django-admin.py``.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
@ -58,11 +56,11 @@ create a ``mysite`` directory in your current directory.
|
||||||
``django`` (which will conflict with Django itself) or ``test`` (which
|
``django`` (which will conflict with Django itself) or ``test`` (which
|
||||||
conflicts with a built-in Python package).
|
conflicts with a built-in Python package).
|
||||||
|
|
||||||
:ref:`django-admin.py <ref-django-admin>` should be on your system path if you
|
:doc:`django-admin.py </ref/django-admin>` should be on your system path if you
|
||||||
installed Django via ``python setup.py``. If it's not on your path, you can find
|
installed Django via ``python setup.py``. If it's not on your path, you can find
|
||||||
it in ``site-packages/django/bin``, where ```site-packages``` is a directory
|
it in ``site-packages/django/bin``, where ```site-packages``` is a directory
|
||||||
within your Python installation. Consider symlinking to :ref:`django-admin.py
|
within your Python installation. Consider symlinking to :doc:`django-admin.py
|
||||||
<ref-django-admin>` from some place on your path, such as
|
</ref/django-admin>` from some place on your path, such as
|
||||||
:file:`/usr/local/bin`.
|
:file:`/usr/local/bin`.
|
||||||
|
|
||||||
.. admonition:: Where should this code live?
|
.. admonition:: Where should this code live?
|
||||||
|
@ -93,14 +91,14 @@ These files are:
|
||||||
|
|
||||||
* :file:`manage.py`: A command-line utility that lets you interact with this
|
* :file:`manage.py`: A command-line utility that lets you interact with this
|
||||||
Django project in various ways. You can read all the details about
|
Django project in various ways. You can read all the details about
|
||||||
:file:`manage.py` in :ref:`ref-django-admin`.
|
:file:`manage.py` in :doc:`/ref/django-admin`.
|
||||||
|
|
||||||
* :file:`settings.py`: Settings/configuration for this Django project.
|
* :file:`settings.py`: Settings/configuration for this Django project.
|
||||||
:ref:`topics-settings` will tell you all about how settings work.
|
:doc:`/topics/settings` will tell you all about how settings work.
|
||||||
|
|
||||||
* :file:`urls.py`: The URL declarations for this Django project; a "table of
|
* :file:`urls.py`: The URL declarations for this Django project; a "table of
|
||||||
contents" of your Django-powered site. You can read more about URLs in
|
contents" of your Django-powered site. You can read more about URLs in
|
||||||
:ref:`topics-http-urls`.
|
:doc:`/topics/http/urls`.
|
||||||
|
|
||||||
.. _more about packages: http://docs.python.org/tutorial/modules.html#packages
|
.. _more about packages: http://docs.python.org/tutorial/modules.html#packages
|
||||||
|
|
||||||
|
@ -473,7 +471,7 @@ added to your project since the last time you ran syncdb. :djadmin:`syncdb` can
|
||||||
be called as often as you like, and it will only ever create the tables that
|
be called as often as you like, and it will only ever create the tables that
|
||||||
don't exist.
|
don't exist.
|
||||||
|
|
||||||
Read the :ref:`django-admin.py documentation <ref-django-admin>` for full
|
Read the :doc:`django-admin.py documentation </ref/django-admin>` for full
|
||||||
information on what the ``manage.py`` utility can do.
|
information on what the ``manage.py`` utility can do.
|
||||||
|
|
||||||
Playing with the API
|
Playing with the API
|
||||||
|
@ -508,10 +506,10 @@ things:
|
||||||
set the ``DJANGO_SETTINGS_MODULE`` environment variable to
|
set the ``DJANGO_SETTINGS_MODULE`` environment variable to
|
||||||
``mysite.settings``.
|
``mysite.settings``.
|
||||||
|
|
||||||
For more information on all of this, see the :ref:`django-admin.py
|
For more information on all of this, see the :doc:`django-admin.py
|
||||||
documentation <ref-django-admin>`.
|
documentation </ref/django-admin>`.
|
||||||
|
|
||||||
Once you're in the shell, explore the :ref:`database API <topics-db-queries>`::
|
Once you're in the shell, explore the :doc:`database API </topics/db/queries>`::
|
||||||
|
|
||||||
>>> from mysite.polls.models import Poll, Choice # Import the model classes we just wrote.
|
>>> from mysite.polls.models import Poll, Choice # Import the model classes we just wrote.
|
||||||
|
|
||||||
|
@ -570,8 +568,8 @@ of this object. Let's fix that by editing the polls model (in the
|
||||||
models and don't see any change in how they're represented, you're most
|
models and don't see any change in how they're represented, you're most
|
||||||
likely using an old version of Django. (This version of the tutorial is
|
likely using an old version of Django. (This version of the tutorial is
|
||||||
written for the latest development version of Django.) If you're using a
|
written for the latest development version of Django.) If you're using a
|
||||||
Subversion checkout of Django's development version (see :ref:`the
|
Subversion checkout of Django's development version (see :doc:`the
|
||||||
installation docs <topics-install>` for more information), you shouldn't have
|
installation docs </topics/install>` for more information), you shouldn't have
|
||||||
any problems.
|
any problems.
|
||||||
|
|
||||||
If you want to stick with an older version of Django, you'll want to switch
|
If you want to stick with an older version of Django, you'll want to switch
|
||||||
|
@ -693,9 +691,9 @@ Save these changes and start a new Python interactive shell by running
|
||||||
>>> c = p.choice_set.filter(choice__startswith='Just hacking')
|
>>> c = p.choice_set.filter(choice__startswith='Just hacking')
|
||||||
>>> c.delete()
|
>>> c.delete()
|
||||||
|
|
||||||
For more information on model relations, see :ref:`Accessing related objects
|
For more information on model relations, see :doc:`Accessing related objects
|
||||||
<ref-models-relations>`. For full details on the database API, see our
|
</ref/models/relations>`. For full details on the database API, see our
|
||||||
:ref:`Database API reference <topics-db-queries>`.
|
:doc:`Database API reference </topics/db/queries>`.
|
||||||
|
|
||||||
When you're comfortable with the API, read :ref:`part 2 of this tutorial
|
When you're comfortable with the API, read :doc:`part 2 of this tutorial
|
||||||
<intro-tutorial02>` to get Django's automatic admin working.
|
</intro/tutorial02>` to get Django's automatic admin working.
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
.. _intro-tutorial02:
|
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Writing your first Django app, part 2
|
Writing your first Django app, part 2
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
This tutorial begins where :ref:`Tutorial 1 <intro-tutorial01>` left off. We're
|
This tutorial begins where :doc:`Tutorial 1 </intro/tutorial01>` left off. We're
|
||||||
continuing the Web-poll application and will focus on Django's
|
continuing the Web-poll application and will focus on Django's
|
||||||
automatically-generated admin site.
|
automatically-generated admin site.
|
||||||
|
|
||||||
|
@ -463,5 +461,5 @@ object-specific admin pages in whatever way you think is best. Again,
|
||||||
don't worry if you can't understand the template language -- we'll cover that
|
don't worry if you can't understand the template language -- we'll cover that
|
||||||
in more detail in Tutorial 3.
|
in more detail in Tutorial 3.
|
||||||
|
|
||||||
When you're comfortable with the admin site, read :ref:`part 3 of this tutorial
|
When you're comfortable with the admin site, read :doc:`part 3 of this tutorial
|
||||||
<intro-tutorial03>` to start working on public poll views.
|
</intro/tutorial03>` to start working on public poll views.
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
.. _intro-tutorial03:
|
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Writing your first Django app, part 3
|
Writing your first Django app, part 3
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
This tutorial begins where :ref:`Tutorial 2 <intro-tutorial02>` left off. We're
|
This tutorial begins where :doc:`Tutorial 2 </intro/tutorial02>` left off. We're
|
||||||
continuing the Web-poll application and will focus on creating the public
|
continuing the Web-poll application and will focus on creating the public
|
||||||
interface -- "views."
|
interface -- "views."
|
||||||
|
|
||||||
|
@ -68,8 +66,8 @@ arbitrary keyword arguments from the dictionary (an optional third item in the
|
||||||
tuple).
|
tuple).
|
||||||
|
|
||||||
For more on :class:`~django.http.HttpRequest` objects, see the
|
For more on :class:`~django.http.HttpRequest` objects, see the
|
||||||
:ref:`ref-request-response`. For more details on URLconfs, see the
|
:doc:`/ref/request-response`. For more details on URLconfs, see the
|
||||||
:ref:`topics-http-urls`.
|
:doc:`/topics/http/urls`.
|
||||||
|
|
||||||
When you ran ``django-admin.py startproject mysite`` at the beginning of
|
When you ran ``django-admin.py startproject mysite`` at the beginning of
|
||||||
Tutorial 1, it created a default URLconf in ``mysite/urls.py``. It also
|
Tutorial 1, it created a default URLconf in ``mysite/urls.py``. It also
|
||||||
|
@ -205,7 +203,7 @@ you want, using whatever Python libraries you want.
|
||||||
All Django wants is that :class:`~django.http.HttpResponse`. Or an exception.
|
All Django wants is that :class:`~django.http.HttpResponse`. Or an exception.
|
||||||
|
|
||||||
Because it's convenient, let's use Django's own database API, which we covered
|
Because it's convenient, let's use Django's own database API, which we covered
|
||||||
in :ref:`Tutorial 1 <intro-tutorial01>`. Here's one stab at the ``index()``
|
in :doc:`Tutorial 1 </intro/tutorial01>`. Here's one stab at the ``index()``
|
||||||
view, which displays the latest 5 poll questions in the system, separated by
|
view, which displays the latest 5 poll questions in the system, separated by
|
||||||
commas, according to publication date::
|
commas, according to publication date::
|
||||||
|
|
||||||
|
@ -425,7 +423,7 @@ Method-calling happens in the ``{% for %}`` loop: ``poll.choice_set.all`` is
|
||||||
interpreted as the Python code ``poll.choice_set.all()``, which returns an
|
interpreted as the Python code ``poll.choice_set.all()``, which returns an
|
||||||
iterable of Choice objects and is suitable for use in the ``{% for %}`` tag.
|
iterable of Choice objects and is suitable for use in the ``{% for %}`` tag.
|
||||||
|
|
||||||
See the :ref:`template guide <topics-templates>` for more about templates.
|
See the :doc:`template guide </topics/templates>` for more about templates.
|
||||||
|
|
||||||
Simplifying the URLconfs
|
Simplifying the URLconfs
|
||||||
========================
|
========================
|
||||||
|
@ -514,5 +512,5 @@ under "/content/polls/", or any other URL root, and the app will still work.
|
||||||
|
|
||||||
All the poll app cares about is its relative URLs, not its absolute URLs.
|
All the poll app cares about is its relative URLs, not its absolute URLs.
|
||||||
|
|
||||||
When you're comfortable with writing views, read :ref:`part 4 of this tutorial
|
When you're comfortable with writing views, read :doc:`part 4 of this tutorial
|
||||||
<intro-tutorial04>` to learn about simple form processing and generic views.
|
</intro/tutorial04>` to learn about simple form processing and generic views.
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
.. _intro-tutorial04:
|
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Writing your first Django app, part 4
|
Writing your first Django app, part 4
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
This tutorial begins where :ref:`Tutorial 3 <intro-tutorial03>` left off. We're
|
This tutorial begins where :doc:`Tutorial 3 </intro/tutorial03>` left off. We're
|
||||||
continuing the Web-poll application and will focus on simple form processing and
|
continuing the Web-poll application and will focus on simple form processing and
|
||||||
cutting down our code.
|
cutting down our code.
|
||||||
|
|
||||||
|
@ -70,7 +68,7 @@ The details of how this works are explained in the documentation for
|
||||||
:ref:`RequestContext <subclassing-context-requestcontext>`.
|
:ref:`RequestContext <subclassing-context-requestcontext>`.
|
||||||
|
|
||||||
Now, let's create a Django view that handles the submitted data and does
|
Now, let's create a Django view that handles the submitted data and does
|
||||||
something with it. Remember, in :ref:`Tutorial 3 <intro-tutorial03>`, we
|
something with it. Remember, in :doc:`Tutorial 3 </intro/tutorial03>`, we
|
||||||
created a URLconf for the polls application that includes this line::
|
created a URLconf for the polls application that includes this line::
|
||||||
|
|
||||||
(r'^(?P<poll_id>\d+)/vote/$', 'vote'),
|
(r'^(?P<poll_id>\d+)/vote/$', 'vote'),
|
||||||
|
@ -149,7 +147,7 @@ This code includes a few things we haven't covered yet in this tutorial:
|
||||||
|
|
||||||
As mentioned in Tutorial 3, ``request`` is a :class:`~django.http.HttpRequest`
|
As mentioned in Tutorial 3, ``request`` is a :class:`~django.http.HttpRequest`
|
||||||
object. For more on :class:`~django.http.HttpRequest` objects, see the
|
object. For more on :class:`~django.http.HttpRequest` objects, see the
|
||||||
:ref:`request and response documentation <ref-request-response>`.
|
:doc:`request and response documentation </ref/request-response>`.
|
||||||
|
|
||||||
After somebody votes in a poll, the ``vote()`` view redirects to the results
|
After somebody votes in a poll, the ``vote()`` view redirects to the results
|
||||||
page for the poll. Let's write that view::
|
page for the poll. Let's write that view::
|
||||||
|
@ -158,8 +156,8 @@ page for the poll. Let's write that view::
|
||||||
p = get_object_or_404(Poll, pk=poll_id)
|
p = get_object_or_404(Poll, pk=poll_id)
|
||||||
return render_to_response('polls/results.html', {'poll': p})
|
return render_to_response('polls/results.html', {'poll': p})
|
||||||
|
|
||||||
This is almost exactly the same as the ``detail()`` view from :ref:`Tutorial 3
|
This is almost exactly the same as the ``detail()`` view from :doc:`Tutorial 3
|
||||||
<intro-tutorial03>`. The only difference is the template name. We'll fix this
|
</intro/tutorial03>`. The only difference is the template name. We'll fix this
|
||||||
redundancy later.
|
redundancy later.
|
||||||
|
|
||||||
Now, create a ``results.html`` template:
|
Now, create a ``results.html`` template:
|
||||||
|
@ -183,7 +181,7 @@ without having chosen a choice, you should see the error message.
|
||||||
Use generic views: Less code is better
|
Use generic views: Less code is better
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
The ``detail()`` (from :ref:`Tutorial 3 <intro-tutorial03>`) and ``results()``
|
The ``detail()`` (from :doc:`Tutorial 3 </intro/tutorial03>`) and ``results()``
|
||||||
views are stupidly simple -- and, as mentioned above, redundant. The ``index()``
|
views are stupidly simple -- and, as mentioned above, redundant. The ``index()``
|
||||||
view (also from Tutorial 3), which displays a list of polls, is similar.
|
view (also from Tutorial 3), which displays a list of polls, is similar.
|
||||||
|
|
||||||
|
@ -328,8 +326,8 @@ are) used multiple times -- but we can use the name we've given::
|
||||||
|
|
||||||
Run the server, and use your new polling app based on generic views.
|
Run the server, and use your new polling app based on generic views.
|
||||||
|
|
||||||
For full details on generic views, see the :ref:`generic views documentation
|
For full details on generic views, see the :doc:`generic views documentation
|
||||||
<topics-http-generic-views>`.
|
</topics/http/generic-views>`.
|
||||||
|
|
||||||
Coming soon
|
Coming soon
|
||||||
===========
|
===========
|
||||||
|
@ -344,5 +342,5 @@ will cover:
|
||||||
* Advanced admin features: Permissions
|
* Advanced admin features: Permissions
|
||||||
* Advanced admin features: Custom JavaScript
|
* Advanced admin features: Custom JavaScript
|
||||||
|
|
||||||
In the meantime, you might want to check out some pointers on :ref:`where to go
|
In the meantime, you might want to check out some pointers on :doc:`where to go
|
||||||
from here <intro-whatsnext>`
|
from here </intro/whatsnext>`
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
.. _intro-whatsnext:
|
|
||||||
|
|
||||||
=================
|
=================
|
||||||
What to read next
|
What to read next
|
||||||
=================
|
=================
|
||||||
|
|
||||||
So you've read all the :ref:`introductory material <intro-index>` and have
|
So you've read all the :doc:`introductory material </intro/index>` and have
|
||||||
decided you'd like to keep using Django. We've only just scratched the surface
|
decided you'd like to keep using Django. We've only just scratched the surface
|
||||||
with this intro (in fact, if you've read every single word you've still read
|
with this intro (in fact, if you've read every single word you've still read
|
||||||
less than 10% of the overall documentation).
|
less than 10% of the overall documentation).
|
||||||
|
@ -37,15 +35,15 @@ How the documentation is organized
|
||||||
Django's main documentation is broken up into "chunks" designed to fill
|
Django's main documentation is broken up into "chunks" designed to fill
|
||||||
different needs:
|
different needs:
|
||||||
|
|
||||||
* The :ref:`introductory material <intro-index>` is designed for people new
|
* The :doc:`introductory material </intro/index>` is designed for people new
|
||||||
to Django -- or to web development in general. It doesn't cover anything
|
to Django -- or to web development in general. It doesn't cover anything
|
||||||
in depth, but instead gives a high-level overview of how developing in
|
in depth, but instead gives a high-level overview of how developing in
|
||||||
Django "feels".
|
Django "feels".
|
||||||
|
|
||||||
* The :ref:`topic guides <topics-index>`, on the other hand, dive deep into
|
* The :doc:`topic guides </topics/index>`, on the other hand, dive deep into
|
||||||
individual parts of Django. There are complete guides to Django's
|
individual parts of Django. There are complete guides to Django's
|
||||||
:ref:`model system <topics-db-index>`, :ref:`template engine
|
:doc:`model system </topics/db/index>`, :doc:`template engine
|
||||||
<topics-templates>`, :ref:`forms framework <topics-forms-index>`, and much
|
</topics/templates>`, :doc:`forms framework </topics/forms/index>`, and much
|
||||||
more.
|
more.
|
||||||
|
|
||||||
This is probably where you'll want to spend most of your time; if you work
|
This is probably where you'll want to spend most of your time; if you work
|
||||||
|
@ -53,27 +51,27 @@ different needs:
|
||||||
everything there is to know about Django.
|
everything there is to know about Django.
|
||||||
|
|
||||||
* Web development is often broad, not deep -- problems span many domains.
|
* Web development is often broad, not deep -- problems span many domains.
|
||||||
We've written a set of :ref:`how-to guides <howto-index>` that answer
|
We've written a set of :doc:`how-to guides </howto/index>` that answer
|
||||||
common "How do I ...?" questions. Here you'll find information about
|
common "How do I ...?" questions. Here you'll find information about
|
||||||
:ref:`generating PDFs with Django <howto-outputting-pdf>`, :ref:`writing
|
:doc:`generating PDFs with Django </howto/outputting-pdf>`, :doc:`writing
|
||||||
custom template tags <howto-custom-template-tags>`, and more.
|
custom template tags </howto/custom-template-tags>`, and more.
|
||||||
|
|
||||||
Answers to really common questions can also be found in the :ref:`FAQ
|
Answers to really common questions can also be found in the :doc:`FAQ
|
||||||
<faq-index>`.
|
</faq/index>`.
|
||||||
|
|
||||||
* The guides and how-to's don't cover every single class, function, and
|
* The guides and how-to's don't cover every single class, function, and
|
||||||
method available in Django -- that would be overwhelming when you're
|
method available in Django -- that would be overwhelming when you're
|
||||||
trying to learn. Instead, details about individual classes, functions,
|
trying to learn. Instead, details about individual classes, functions,
|
||||||
methods, and modules are kept in the :ref:`reference <ref-index>`. This is
|
methods, and modules are kept in the :doc:`reference </ref/index>`. This is
|
||||||
where you'll turn to find the details of a particular function or
|
where you'll turn to find the details of a particular function or
|
||||||
whathaveyou.
|
whathaveyou.
|
||||||
|
|
||||||
* Finally, there's some "specialized" documentation not usually relevant to
|
* Finally, there's some "specialized" documentation not usually relevant to
|
||||||
most developers. This includes the :ref:`release notes <releases-index>`,
|
most developers. This includes the :doc:`release notes </releases/index>`,
|
||||||
:ref:`documentation of obsolete features <obsolete-index>`,
|
:doc:`documentation of obsolete features </obsolete/index>`,
|
||||||
:ref:`internals documentation <internals-index>` for those who want to add
|
:doc:`internals documentation </internals/index>` for those who want to add
|
||||||
code to Django itself, and a :ref:`few other things that simply don't fit
|
code to Django itself, and a :doc:`few other things that simply don't fit
|
||||||
elsewhere <misc-index>`.
|
elsewhere </misc/index>`.
|
||||||
|
|
||||||
|
|
||||||
How documentation is updated
|
How documentation is updated
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
.. _misc-api-stability:
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
API stability
|
API stability
|
||||||
=============
|
=============
|
||||||
|
|
||||||
:ref:`The release of Django 1.0 <releases-1.0>` comes with a promise of API
|
:doc:`The release of Django 1.0 </releases/1.0>` comes with a promise of API
|
||||||
stability and forwards-compatibility. In a nutshell, this means that code you
|
stability and forwards-compatibility. In a nutshell, this means that code you
|
||||||
develop against Django 1.0 will continue to work against 1.1 unchanged, and you
|
develop against Django 1.0 will continue to work against 1.1 unchanged, and you
|
||||||
should need to make only minor changes for any 1.X release.
|
should need to make only minor changes for any 1.X release.
|
||||||
|
@ -37,67 +35,67 @@ Stable APIs
|
||||||
===========
|
===========
|
||||||
|
|
||||||
In general, everything covered in the documentation -- with the exception of
|
In general, everything covered in the documentation -- with the exception of
|
||||||
anything in the :ref:`internals area <internals-index>` is considered stable as
|
anything in the :doc:`internals area </internals/index>` is considered stable as
|
||||||
of 1.0. This includes these APIs:
|
of 1.0. This includes these APIs:
|
||||||
|
|
||||||
- :ref:`Authorization <topics-auth>`
|
- :doc:`Authorization </topics/auth>`
|
||||||
|
|
||||||
- :ref:`Caching <topics-cache>`.
|
- :doc:`Caching </topics/cache>`.
|
||||||
|
|
||||||
- :ref:`Model definition, managers, querying and transactions
|
- :doc:`Model definition, managers, querying and transactions
|
||||||
<topics-db-index>`
|
</topics/db/index>`
|
||||||
|
|
||||||
- :ref:`Sending e-mail <topics-email>`.
|
- :doc:`Sending e-mail </topics/email>`.
|
||||||
|
|
||||||
- :ref:`File handling and storage <topics-files>`
|
- :doc:`File handling and storage </topics/files>`
|
||||||
|
|
||||||
- :ref:`Forms <topics-forms-index>`
|
- :doc:`Forms </topics/forms/index>`
|
||||||
|
|
||||||
- :ref:`HTTP request/response handling <topics-http-index>`, including file
|
- :doc:`HTTP request/response handling </topics/http/index>`, including file
|
||||||
uploads, middleware, sessions, URL resolution, view, and shortcut APIs.
|
uploads, middleware, sessions, URL resolution, view, and shortcut APIs.
|
||||||
|
|
||||||
- :ref:`Generic views <topics-http-generic-views>`.
|
- :doc:`Generic views </topics/http/generic-views>`.
|
||||||
|
|
||||||
- :ref:`Internationalization <topics-i18n>`.
|
- :doc:`Internationalization </topics/i18n/index>`.
|
||||||
|
|
||||||
- :ref:`Pagination <topics-pagination>`
|
- :doc:`Pagination </topics/pagination>`
|
||||||
|
|
||||||
- :ref:`Serialization <topics-serialization>`
|
- :doc:`Serialization </topics/serialization>`
|
||||||
|
|
||||||
- :ref:`Signals <topics-signals>`
|
- :doc:`Signals </topics/signals>`
|
||||||
|
|
||||||
- :ref:`Templates <topics-templates>`, including the language, Python-level
|
- :doc:`Templates </topics/templates>`, including the language, Python-level
|
||||||
:ref:`template APIs <ref-templates-index>`, and :ref:`custom template tags
|
:doc:`template APIs </ref/templates/index>`, and :doc:`custom template tags
|
||||||
and libraries <howto-custom-template-tags>`. We may add new template
|
and libraries </howto/custom-template-tags>`. We may add new template
|
||||||
tags in the future and the names may inadvertently clash with
|
tags in the future and the names may inadvertently clash with
|
||||||
external template tags. Before adding any such tags, we'll ensure that
|
external template tags. Before adding any such tags, we'll ensure that
|
||||||
Django raises an error if it tries to load tags with duplicate names.
|
Django raises an error if it tries to load tags with duplicate names.
|
||||||
|
|
||||||
- :ref:`Testing <topics-testing>`
|
- :doc:`Testing </topics/testing>`
|
||||||
|
|
||||||
- :ref:`django-admin utility <ref-django-admin>`.
|
- :doc:`django-admin utility </ref/django-admin>`.
|
||||||
|
|
||||||
- :ref:`Built-in middleware <ref-middleware>`
|
- :doc:`Built-in middleware </ref/middleware>`
|
||||||
|
|
||||||
- :ref:`Request/response objects <ref-request-response>`.
|
- :doc:`Request/response objects </ref/request-response>`.
|
||||||
|
|
||||||
- :ref:`Settings <ref-settings>`. Note, though that while the :ref:`list of
|
- :doc:`Settings </ref/settings>`. Note, though that while the :doc:`list of
|
||||||
built-in settings <ref-settings>` can be considered complete we may -- and
|
built-in settings </ref/settings>` can be considered complete we may -- and
|
||||||
probably will -- add new settings in future versions. This is one of those
|
probably will -- add new settings in future versions. This is one of those
|
||||||
places where "'stable' does not mean 'complete.'"
|
places where "'stable' does not mean 'complete.'"
|
||||||
|
|
||||||
- :ref:`Built-in signals <ref-signals>`. Like settings, we'll probably add
|
- :doc:`Built-in signals </ref/signals>`. Like settings, we'll probably add
|
||||||
new signals in the future, but the existing ones won't break.
|
new signals in the future, but the existing ones won't break.
|
||||||
|
|
||||||
- :ref:`Unicode handling <ref-unicode>`.
|
- :doc:`Unicode handling </ref/unicode>`.
|
||||||
|
|
||||||
- Everything covered by the :ref:`HOWTO guides <howto-index>`.
|
- Everything covered by the :doc:`HOWTO guides </howto/index>`.
|
||||||
|
|
||||||
``django.utils``
|
``django.utils``
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Most of the modules in ``django.utils`` are designed for internal use. Only
|
Most of the modules in ``django.utils`` are designed for internal use. Only
|
||||||
the following parts of :ref:`django.utils <ref-utils>` can be considered stable:
|
the following parts of :doc:`django.utils </ref/utils>` can be considered stable:
|
||||||
|
|
||||||
- ``django.utils.cache``
|
- ``django.utils.cache``
|
||||||
- ``django.utils.datastructures.SortedDict`` -- only this single class; the
|
- ``django.utils.datastructures.SortedDict`` -- only this single class; the
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _misc-design-philosophies:
|
|
||||||
|
|
||||||
===================
|
===================
|
||||||
Design philosophies
|
Design philosophies
|
||||||
===================
|
===================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _misc-distributions:
|
|
||||||
|
|
||||||
===================================
|
===================================
|
||||||
Third-party distributions of Django
|
Third-party distributions of Django
|
||||||
===================================
|
===================================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _misc-index:
|
|
||||||
|
|
||||||
Meta-documentation and miscellany
|
Meta-documentation and miscellany
|
||||||
=================================
|
=================================
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _obsolete-admin-css:
|
|
||||||
|
|
||||||
======================================
|
======================================
|
||||||
Customizing the Django admin interface
|
Customizing the Django admin interface
|
||||||
======================================
|
======================================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _obsolete-index:
|
|
||||||
|
|
||||||
Deprecated/obsolete documentation
|
Deprecated/obsolete documentation
|
||||||
=================================
|
=================================
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-authentication-backends:
|
|
||||||
|
|
||||||
=======================
|
=======================
|
||||||
Authentication backends
|
Authentication backends
|
||||||
=======================
|
=======================
|
||||||
|
@ -10,8 +8,8 @@ Authentication backends
|
||||||
This document details the authentication backends that come with Django. For
|
This document details the authentication backends that come with Django. For
|
||||||
information on how to use them and how to write your own authentication
|
information on how to use them and how to write your own authentication
|
||||||
backends, see the :ref:`Other authentication sources section
|
backends, see the :ref:`Other authentication sources section
|
||||||
<authentication-backends>` of the :ref:`User authentication guide
|
<authentication-backends>` of the :doc:`User authentication guide
|
||||||
<topics-auth>`.
|
</topics/auth>`.
|
||||||
|
|
||||||
|
|
||||||
Available authentication backends
|
Available authentication backends
|
||||||
|
@ -33,5 +31,5 @@ The following backends are available in :mod:`django.contrib.auth.backends`:
|
||||||
Use this backend to take advantage of external-to-Django-handled
|
Use this backend to take advantage of external-to-Django-handled
|
||||||
authentication. It authenticates using usernames passed in
|
authentication. It authenticates using usernames passed in
|
||||||
:attr:`request.META['REMOTE_USER'] <django.http.HttpRequest.META>`. See
|
:attr:`request.META['REMOTE_USER'] <django.http.HttpRequest.META>`. See
|
||||||
the :ref:`Authenticating against REMOTE_USER <howto-auth-remote-user>`
|
the :doc:`Authenticating against REMOTE_USER </howto/auth-remote-user>`
|
||||||
documentation.
|
documentation.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-admin-actions:
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
Admin actions
|
Admin actions
|
||||||
=============
|
=============
|
||||||
|
@ -208,7 +206,7 @@ objects.
|
||||||
To provide an intermediary page, simply return an
|
To provide an intermediary page, simply return an
|
||||||
:class:`~django.http.HttpResponse` (or subclass) from your action. For
|
:class:`~django.http.HttpResponse` (or subclass) from your action. For
|
||||||
example, you might write a simple export function that uses Django's
|
example, you might write a simple export function that uses Django's
|
||||||
:ref:`serialization functions <topics-serialization>` to dump some selected
|
:doc:`serialization functions </topics/serialization>` to dump some selected
|
||||||
objects as JSON::
|
objects as JSON::
|
||||||
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-admin:
|
|
||||||
|
|
||||||
=====================
|
=====================
|
||||||
The Django admin site
|
The Django admin site
|
||||||
=====================
|
=====================
|
||||||
|
@ -678,7 +676,7 @@ do that::
|
||||||
|
|
||||||
Note that the key in the dictionary is the actual field class, *not* a string.
|
Note that the key in the dictionary is the actual field class, *not* a string.
|
||||||
The value is another dictionary; these arguments will be passed to
|
The value is another dictionary; these arguments will be passed to
|
||||||
:meth:`~django.forms.Field.__init__`. See :ref:`ref-forms-api` for details.
|
:meth:`~django.forms.Field.__init__`. See :doc:`/ref/forms/api` for details.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
@ -696,7 +694,7 @@ The value is another dictionary; these arguments will be passed to
|
||||||
.. versionadded:: 1.1
|
.. versionadded:: 1.1
|
||||||
|
|
||||||
A list of actions to make available on the change list page. See
|
A list of actions to make available on the change list page. See
|
||||||
:ref:`ref-contrib-admin-actions` for details.
|
:doc:`/ref/contrib/admin/actions` for details.
|
||||||
|
|
||||||
.. attribute:: ModelAdmin.actions_on_top
|
.. attribute:: ModelAdmin.actions_on_top
|
||||||
.. attribute:: ModelAdmin.actions_on_bottom
|
.. attribute:: ModelAdmin.actions_on_bottom
|
||||||
|
@ -747,8 +745,8 @@ templates used by the :class:`ModelAdmin` views:
|
||||||
|
|
||||||
Path to a custom template, used by the :meth:`delete_selected`
|
Path to a custom template, used by the :meth:`delete_selected`
|
||||||
action method for displaying a confirmation page when deleting one
|
action method for displaying a confirmation page when deleting one
|
||||||
or more objects. See the :ref:`actions
|
or more objects. See the :doc:`actions
|
||||||
documentation<ref-contrib-admin-actions>`.
|
documentation</ref/contrib/admin/actions>`.
|
||||||
|
|
||||||
.. attribute:: ModelAdmin.object_history_template
|
.. attribute:: ModelAdmin.object_history_template
|
||||||
|
|
||||||
|
@ -805,7 +803,7 @@ described above in the :attr:`ModelAdmin.readonly_fields` section.
|
||||||
|
|
||||||
The ``get_urls`` method on a ``ModelAdmin`` returns the URLs to be used for
|
The ``get_urls`` method on a ``ModelAdmin`` returns the URLs to be used for
|
||||||
that ModelAdmin in the same way as a URLconf. Therefore you can extend them as
|
that ModelAdmin in the same way as a URLconf. Therefore you can extend them as
|
||||||
documented in :ref:`topics-http-urls`::
|
documented in :doc:`/topics/http/urls`::
|
||||||
|
|
||||||
class MyModelAdmin(admin.ModelAdmin):
|
class MyModelAdmin(admin.ModelAdmin):
|
||||||
def get_urls(self):
|
def get_urls(self):
|
||||||
|
@ -969,7 +967,7 @@ on your ``ModelAdmin``::
|
||||||
js = ("my_code.js",)
|
js = ("my_code.js",)
|
||||||
|
|
||||||
Keep in mind that this will be prepended with ``MEDIA_URL``. The same rules
|
Keep in mind that this will be prepended with ``MEDIA_URL``. The same rules
|
||||||
apply as :ref:`regular media definitions on forms <topics-forms-media>`.
|
apply as :doc:`regular media definitions on forms </topics/forms/media>`.
|
||||||
|
|
||||||
Django admin Javascript makes use of the `jQuery`_ library. To avoid
|
Django admin Javascript makes use of the `jQuery`_ library. To avoid
|
||||||
conflict with user scripts, Django's jQuery is namespaced as
|
conflict with user scripts, Django's jQuery is namespaced as
|
||||||
|
@ -1002,8 +1000,8 @@ any field::
|
||||||
return self.cleaned_data["name"]
|
return self.cleaned_data["name"]
|
||||||
|
|
||||||
It is important you use a ``ModelForm`` here otherwise things can break. See the
|
It is important you use a ``ModelForm`` here otherwise things can break. See the
|
||||||
:ref:`forms <ref-forms-index>` documentation on :ref:`custom validation
|
:doc:`forms </ref/forms/index>` documentation on :doc:`custom validation
|
||||||
<ref-forms-validation>` and, more specifically, the
|
</ref/forms/validation>` and, more specifically, the
|
||||||
:ref:`model form validation notes <overriding-modelform-clean-method>` for more
|
:ref:`model form validation notes <overriding-modelform-clean-method>` for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
|
@ -1075,7 +1073,7 @@ all the same functionality as well as some of its own:
|
||||||
|
|
||||||
This controls the number of extra forms the formset will display in addition
|
This controls the number of extra forms the formset will display in addition
|
||||||
to the initial forms. See the
|
to the initial forms. See the
|
||||||
:ref:`formsets documentation <topics-forms-formsets>` for more information.
|
:doc:`formsets documentation </topics/forms/formsets>` for more information.
|
||||||
|
|
||||||
.. versionadded:: 1.2
|
.. versionadded:: 1.2
|
||||||
|
|
||||||
|
@ -1298,7 +1296,7 @@ example app::
|
||||||
|
|
||||||
``django.contrib.contenttypes.generic`` provides both a ``GenericTabularInline``
|
``django.contrib.contenttypes.generic`` provides both a ``GenericTabularInline``
|
||||||
and ``GenericStackedInline`` and behave just like any other inline. See the
|
and ``GenericStackedInline`` and behave just like any other inline. See the
|
||||||
:ref:`contenttypes documentation <ref-contrib-contenttypes>` for more specific
|
:doc:`contenttypes documentation </ref/contrib/contenttypes>` for more specific
|
||||||
information.
|
information.
|
||||||
|
|
||||||
Overriding Admin Templates
|
Overriding Admin Templates
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
.. _ref-contrib-auth:
|
|
||||||
|
|
||||||
``django.contrib.auth``
|
``django.contrib.auth``
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
See :ref:`topics-auth`.
|
See :doc:`/topics/auth`.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-custom:
|
|
||||||
|
|
||||||
==================================
|
==================================
|
||||||
Customizing the comments framework
|
Customizing the comments framework
|
||||||
==================================
|
==================================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-example:
|
|
||||||
|
|
||||||
.. highlightlang:: html+django
|
.. highlightlang:: html+django
|
||||||
|
|
||||||
===========================================
|
===========================================
|
||||||
|
@ -7,7 +5,7 @@ Example of using the in-built comments app
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
Follow the first three steps of the quick start guide in the
|
Follow the first three steps of the quick start guide in the
|
||||||
:ref:`documentation <ref-contrib-comments-index>`.
|
:doc:`documentation </ref/contrib/comments/index>`.
|
||||||
|
|
||||||
Now suppose, you have an app (``blog``) with a model (``Post``)
|
Now suppose, you have an app (``blog``) with a model (``Post``)
|
||||||
to which you want to attach comments. Let us also suppose that
|
to which you want to attach comments. Let us also suppose that
|
||||||
|
@ -85,8 +83,8 @@ It looks for the ``form.html`` under the following directories
|
||||||
|
|
||||||
Since we customize the form in the second method, we make use of another
|
Since we customize the form in the second method, we make use of another
|
||||||
tag called :ttag:`comment_form_target`. This tag on rendering gives the URL
|
tag called :ttag:`comment_form_target`. This tag on rendering gives the URL
|
||||||
where the comment form is posted. Without any :ref:`customization
|
where the comment form is posted. Without any :doc:`customization
|
||||||
<ref-contrib-comments-custom>`, :ttag:`comment_form_target` evaluates to
|
</ref/contrib/comments/custom>`, :ttag:`comment_form_target` evaluates to
|
||||||
``/comments/post/``. We use this tag in the form's ``action`` attribute.
|
``/comments/post/``. We use this tag in the form's ``action`` attribute.
|
||||||
|
|
||||||
The :ttag:`get_comment_form` tag renders a ``form`` for a model instance by
|
The :ttag:`get_comment_form` tag renders a ``form`` for a model instance by
|
||||||
|
@ -136,7 +134,7 @@ found under the directory structure we saw for ``form.html``.
|
||||||
Feeds
|
Feeds
|
||||||
=====
|
=====
|
||||||
|
|
||||||
Suppose you want to export a :ref:`feed <ref-contrib-syndication>` of the
|
Suppose you want to export a :doc:`feed </ref/contrib/syndication>` of the
|
||||||
latest comments, you can use the in-built :class:`LatestCommentFeed`. Just
|
latest comments, you can use the in-built :class:`LatestCommentFeed`. Just
|
||||||
enable it in your project's ``urls.py``:
|
enable it in your project's ``urls.py``:
|
||||||
|
|
||||||
|
@ -163,8 +161,8 @@ Moderation
|
||||||
|
|
||||||
Now that we have the comments framework working, we might want to have some
|
Now that we have the comments framework working, we might want to have some
|
||||||
moderation setup to administer the comments. The comments framework comes
|
moderation setup to administer the comments. The comments framework comes
|
||||||
in-built with :ref:`generic comment moderation
|
in-built with :doc:`generic comment moderation
|
||||||
<ref-contrib-comments-moderation>`. The comment moderation has the following
|
</ref/contrib/comments/moderation>`. The comment moderation has the following
|
||||||
features (all of which or only certain can be enabled):
|
features (all of which or only certain can be enabled):
|
||||||
|
|
||||||
* Enable comments for a particular model instance.
|
* Enable comments for a particular model instance.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-forms:
|
|
||||||
|
|
||||||
====================
|
====================
|
||||||
Comment form classes
|
Comment form classes
|
||||||
====================
|
====================
|
||||||
|
@ -9,7 +7,7 @@ Comment form classes
|
||||||
|
|
||||||
The ``django.contrib.comments.forms`` module contains a handful of forms
|
The ``django.contrib.comments.forms`` module contains a handful of forms
|
||||||
you'll use when writing custom views dealing with comments, or when writing
|
you'll use when writing custom views dealing with comments, or when writing
|
||||||
:ref:`custom comment apps <ref-contrib-comments-custom>`.
|
:doc:`custom comment apps </ref/contrib/comments/custom>`.
|
||||||
|
|
||||||
.. class:: CommentForm
|
.. class:: CommentForm
|
||||||
|
|
||||||
|
@ -23,7 +21,7 @@ you'll use when writing custom views dealing with comments, or when writing
|
||||||
Abstract comment forms for custom comment apps
|
Abstract comment forms for custom comment apps
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
If you're building a :ref:`custom comment app <ref-contrib-comments-custom>`,
|
If you're building a :doc:`custom comment app </ref/contrib/comments/custom>`,
|
||||||
you might want to replace *some* of the form logic but still rely on parts of
|
you might want to replace *some* of the form logic but still rely on parts of
|
||||||
the existing form.
|
the existing form.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-index:
|
|
||||||
|
|
||||||
===========================
|
===========================
|
||||||
Django's comments framework
|
Django's comments framework
|
||||||
===========================
|
===========================
|
||||||
|
@ -16,7 +14,7 @@ it for comments on blog entries, photos, book chapters, or anything else.
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If you used to use Django's older (undocumented) comments framework, you'll
|
If you used to use Django's older (undocumented) comments framework, you'll
|
||||||
need to upgrade. See the :ref:`upgrade guide <ref-contrib-comments-upgrade>`
|
need to upgrade. See the :doc:`upgrade guide </ref/contrib/comments/upgrade>`
|
||||||
for instructions.
|
for instructions.
|
||||||
|
|
||||||
Quick start guide
|
Quick start guide
|
||||||
|
@ -42,7 +40,7 @@ To get started using the ``comments`` app, follow these steps:
|
||||||
#. Use the `comment template tags`_ below to embed comments in your
|
#. Use the `comment template tags`_ below to embed comments in your
|
||||||
templates.
|
templates.
|
||||||
|
|
||||||
You might also want to examine :ref:`ref-contrib-comments-settings`.
|
You might also want to examine :doc:`/ref/contrib/comments/settings`.
|
||||||
|
|
||||||
Comment template tags
|
Comment template tags
|
||||||
=====================
|
=====================
|
||||||
|
@ -124,7 +122,7 @@ For example::
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
This returns a list of :class:`~django.contrib.comments.models.Comment` objects;
|
This returns a list of :class:`~django.contrib.comments.models.Comment` objects;
|
||||||
see :ref:`the comment model documentation <ref-contrib-comments-models>` for
|
see :doc:`the comment model documentation </ref/contrib/comments/models>` for
|
||||||
details.
|
details.
|
||||||
|
|
||||||
.. templatetag:: get_comment_permalink
|
.. templatetag:: get_comment_permalink
|
||||||
|
@ -212,7 +210,7 @@ Rendering a custom comment form
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
If you want more control over the look and feel of the comment form, you use use
|
If you want more control over the look and feel of the comment form, you use use
|
||||||
:ttag:`get_comment_form` to get a :ref:`form object <topics-forms-index>` that
|
:ttag:`get_comment_form` to get a :doc:`form object </topics/forms/index>` that
|
||||||
you can use in the template::
|
you can use in the template::
|
||||||
|
|
||||||
{% get_comment_form for [object] as [varname] %}
|
{% get_comment_form for [object] as [varname] %}
|
||||||
|
@ -279,8 +277,8 @@ should know about:
|
||||||
it with a warning field; if you use the comment form with a custom
|
it with a warning field; if you use the comment form with a custom
|
||||||
template you should be sure to do the same.
|
template you should be sure to do the same.
|
||||||
|
|
||||||
The comments app also depends on the more general :ref:`Cross Site Request
|
The comments app also depends on the more general :doc:`Cross Site Request
|
||||||
Forgery protection < ref-contrib-csrf>` that comes with Django. As described in
|
Forgery protection </ref/contrib/csrf>` that comes with Django. As described in
|
||||||
the documentation, it is best to use ``CsrfViewMiddleware``. However, if you
|
the documentation, it is best to use ``CsrfViewMiddleware``. However, if you
|
||||||
are not using that, you will need to use the ``csrf_protect`` decorator on any
|
are not using that, you will need to use the ``csrf_protect`` decorator on any
|
||||||
views that include the comment form, in order for those views to be able to
|
views that include the comment form, in order for those views to be able to
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-models:
|
|
||||||
|
|
||||||
===========================
|
===========================
|
||||||
The built-in comment models
|
The built-in comment models
|
||||||
===========================
|
===========================
|
||||||
|
@ -72,7 +70,7 @@ The built-in comment models
|
||||||
.. attribute:: is_public
|
.. attribute:: is_public
|
||||||
|
|
||||||
``False`` if the comment is in moderation (see
|
``False`` if the comment is in moderation (see
|
||||||
:ref:`ref-contrib-comments-moderation`); If ``True``, the comment will
|
:doc:`/ref/contrib/comments/moderation`); If ``True``, the comment will
|
||||||
be displayed on the site.
|
be displayed on the site.
|
||||||
|
|
||||||
.. attribute:: is_removed
|
.. attribute:: is_removed
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-moderation:
|
|
||||||
|
|
||||||
==========================
|
==========================
|
||||||
Generic comment moderation
|
Generic comment moderation
|
||||||
==========================
|
==========================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-settings:
|
|
||||||
|
|
||||||
================
|
================
|
||||||
Comment settings
|
Comment settings
|
||||||
================
|
================
|
||||||
|
@ -29,7 +27,7 @@ this will be rejected. Defaults to 3000.
|
||||||
COMMENTS_APP
|
COMMENTS_APP
|
||||||
------------
|
------------
|
||||||
|
|
||||||
An app which provides :ref:`customization of the comments framework
|
An app which provides :doc:`customization of the comments framework
|
||||||
<ref-contrib-comments-custom>`. Use the same dotted-string notation
|
</ref/contrib/comments/custom>`. Use the same dotted-string notation
|
||||||
as in :setting:`INSTALLED_APPS`. Your custom :setting:`COMMENTS_APP`
|
as in :setting:`INSTALLED_APPS`. Your custom :setting:`COMMENTS_APP`
|
||||||
must also be listed in :setting:`INSTALLED_APPS`.
|
must also be listed in :setting:`INSTALLED_APPS`.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-signals:
|
|
||||||
|
|
||||||
================================
|
================================
|
||||||
Signals sent by the comments app
|
Signals sent by the comments app
|
||||||
================================
|
================================
|
||||||
|
@ -7,9 +5,9 @@ Signals sent by the comments app
|
||||||
.. module:: django.contrib.comments.signals
|
.. module:: django.contrib.comments.signals
|
||||||
:synopsis: Signals sent by the comment module.
|
:synopsis: Signals sent by the comment module.
|
||||||
|
|
||||||
The comment app sends a series of :ref:`signals <topics-signals>` to allow for
|
The comment app sends a series of :doc:`signals </topics/signals>` to allow for
|
||||||
comment moderation and similar activities. See :ref:`the introduction to signals
|
comment moderation and similar activities. See :doc:`the introduction to signals
|
||||||
<topics-signals>` for information about how to register for and receive these
|
</topics/signals>` for information about how to register for and receive these
|
||||||
signals.
|
signals.
|
||||||
|
|
||||||
comment_will_be_posted
|
comment_will_be_posted
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-comments-upgrade:
|
|
||||||
|
|
||||||
===============================================
|
===============================================
|
||||||
Upgrading from Django's previous comment system
|
Upgrading from Django's previous comment system
|
||||||
===============================================
|
===============================================
|
||||||
|
@ -11,8 +9,8 @@ The main changes from the old system are:
|
||||||
|
|
||||||
* This new system is documented.
|
* This new system is documented.
|
||||||
|
|
||||||
* It uses modern Django features like :ref:`forms <topics-forms-index>` and
|
* It uses modern Django features like :doc:`forms </topics/forms/index>` and
|
||||||
:ref:`modelforms <topics-forms-modelforms>`.
|
:doc:`modelforms </topics/forms/modelforms>`.
|
||||||
|
|
||||||
* It has a single ``Comment`` model instead of separate ``FreeComment`` and
|
* It has a single ``Comment`` model instead of separate ``FreeComment`` and
|
||||||
``Comment`` models.
|
``Comment`` models.
|
||||||
|
@ -42,7 +40,7 @@ The data models for Django's comment system have changed, as have the
|
||||||
table names. Before you transfer your existing data into the new comments
|
table names. Before you transfer your existing data into the new comments
|
||||||
system, make sure that you have installed the new comments system as
|
system, make sure that you have installed the new comments system as
|
||||||
explained in the
|
explained in the
|
||||||
:ref:`quick start guide <ref-contrib-comments-index>`.
|
:doc:`quick start guide </ref/contrib/comments/index>`.
|
||||||
This will ensure that the new tables have been properly created.
|
This will ensure that the new tables have been properly created.
|
||||||
|
|
||||||
To transfer your data into the new comments system, you'll need to directly
|
To transfer your data into the new comments system, you'll need to directly
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-contenttypes:
|
|
||||||
|
|
||||||
==========================
|
==========================
|
||||||
The contenttypes framework
|
The contenttypes framework
|
||||||
==========================
|
==========================
|
||||||
|
@ -346,7 +344,7 @@ it would be deleted at the same time.
|
||||||
Generic relations and aggregation
|
Generic relations and aggregation
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
:ref:`Django's database aggregation API <topics-db-aggregation>`
|
:doc:`Django's database aggregation API </topics/db/aggregation>`
|
||||||
doesn't work with a
|
doesn't work with a
|
||||||
:class:`~django.contrib.contenttypes.generic.GenericRelation`. For example, you
|
:class:`~django.contrib.contenttypes.generic.GenericRelation`. For example, you
|
||||||
might be tempted to try something like::
|
might be tempted to try something like::
|
||||||
|
@ -365,8 +363,8 @@ Generic relations in forms and admin
|
||||||
:class:`~django.contrib.contenttypes.generic.GenericInlineFormSet`
|
:class:`~django.contrib.contenttypes.generic.GenericInlineFormSet`
|
||||||
and :class:`~django.contrib.contenttypes.generic.GenericInlineModelAdmin`.
|
and :class:`~django.contrib.contenttypes.generic.GenericInlineModelAdmin`.
|
||||||
This enables the use of generic relations in forms and the admin. See the
|
This enables the use of generic relations in forms and the admin. See the
|
||||||
:ref:`model formset <topics-forms-modelforms>` and
|
:doc:`model formset </topics/forms/modelforms>` and
|
||||||
:ref:`admin <ref-contrib-admin>` documentation for more information.
|
:doc:`admin </ref/contrib/admin/index>` documentation for more information.
|
||||||
|
|
||||||
.. class:: generic.GenericInlineModelAdmin
|
.. class:: generic.GenericInlineModelAdmin
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-csrf:
|
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
Cross Site Request Forgery protection
|
Cross Site Request Forgery protection
|
||||||
=====================================
|
=====================================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-databrowse:
|
|
||||||
|
|
||||||
==========
|
==========
|
||||||
Databrowse
|
Databrowse
|
||||||
==========
|
==========
|
||||||
|
@ -49,8 +47,8 @@ How to use Databrowse
|
||||||
Note that you should register the model *classes*, not instances.
|
Note that you should register the model *classes*, not instances.
|
||||||
|
|
||||||
It doesn't matter where you put this, as long as it gets executed at some
|
It doesn't matter where you put this, as long as it gets executed at some
|
||||||
point. A good place for it is in your :ref:`URLconf file
|
point. A good place for it is in your :doc:`URLconf file
|
||||||
<topics-http-urls>` (``urls.py``).
|
</topics/http/urls>` (``urls.py``).
|
||||||
|
|
||||||
3. Change your URLconf to import the :mod:`~django.contrib.databrowse` module::
|
3. Change your URLconf to import the :mod:`~django.contrib.databrowse` module::
|
||||||
|
|
||||||
|
@ -73,20 +71,20 @@ code. Simply add the following import to your URLconf::
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
Then modify the :ref:`URLconf <topics-http-urls>` so that the
|
Then modify the :doc:`URLconf </topics/http/urls>` so that the
|
||||||
:func:`databrowse.site.root` view is decorated with
|
:func:`databrowse.site.root` view is decorated with
|
||||||
:func:`django.contrib.auth.decorators.login_required`::
|
:func:`django.contrib.auth.decorators.login_required`::
|
||||||
|
|
||||||
(r'^databrowse/(.*)', login_required(databrowse.site.root)),
|
(r'^databrowse/(.*)', login_required(databrowse.site.root)),
|
||||||
|
|
||||||
If you haven't already added support for user logins to your :ref:`URLconf
|
If you haven't already added support for user logins to your :doc:`URLconf
|
||||||
<topics-http-urls>`, as described in the :ref:`user authentication docs
|
</topics/http/urls>`, as described in the :doc:`user authentication docs
|
||||||
<ref-contrib-auth>`, then you will need to do so now with the following
|
</ref/contrib/auth>`, then you will need to do so now with the following
|
||||||
mapping::
|
mapping::
|
||||||
|
|
||||||
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
|
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
|
||||||
|
|
||||||
The final step is to create the login form required by
|
The final step is to create the login form required by
|
||||||
:func:`django.contrib.auth.views.login`. The
|
:func:`django.contrib.auth.views.login`. The
|
||||||
:ref:`user authentication docs <ref-contrib-auth>` provide full details and a
|
:doc:`user authentication docs </ref/contrib/auth>` provide full details and a
|
||||||
sample template that can be used for this purpose.
|
sample template that can be used for this purpose.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-flatpages:
|
|
||||||
|
|
||||||
=================
|
=================
|
||||||
The flatpages app
|
The flatpages app
|
||||||
=================
|
=================
|
||||||
|
@ -92,8 +90,8 @@ Note that the order of :setting:`MIDDLEWARE_CLASSES` matters. Generally, you can
|
||||||
put :class:`~django.contrib.flatpages.middleware.FlatpageFallbackMiddleware` at
|
put :class:`~django.contrib.flatpages.middleware.FlatpageFallbackMiddleware` at
|
||||||
the end of the list, because it's a last resort.
|
the end of the list, because it's a last resort.
|
||||||
|
|
||||||
For more on middleware, read the :ref:`middleware docs
|
For more on middleware, read the :doc:`middleware docs
|
||||||
<topics-http-middleware>`.
|
</topics/http/middleware>`.
|
||||||
|
|
||||||
.. admonition:: Ensure that your 404 template works
|
.. admonition:: Ensure that your 404 template works
|
||||||
|
|
||||||
|
@ -124,9 +122,9 @@ Via the Python API
|
||||||
.. class:: models.FlatPage
|
.. class:: models.FlatPage
|
||||||
|
|
||||||
Flatpages are represented by a standard
|
Flatpages are represented by a standard
|
||||||
:ref:`Django model <topics-db-models>`,
|
:doc:`Django model </topics/db/models>`,
|
||||||
which lives in `django/contrib/flatpages/models.py`_. You can access
|
which lives in `django/contrib/flatpages/models.py`_. You can access
|
||||||
flatpage objects via the :ref:`Django database API <topics-db-queries>`.
|
flatpage objects via the :doc:`Django database API </topics/db/queries>`.
|
||||||
|
|
||||||
.. _django/contrib/flatpages/models.py: http://code.djangoproject.com/browser/django/trunk/django/contrib/flatpages/models.py
|
.. _django/contrib/flatpages/models.py: http://code.djangoproject.com/browser/django/trunk/django/contrib/flatpages/models.py
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-formtools-form-preview:
|
|
||||||
|
|
||||||
============
|
============
|
||||||
Form preview
|
Form preview
|
||||||
============
|
============
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-formtools-form-wizard:
|
|
||||||
|
|
||||||
===========
|
===========
|
||||||
Form wizard
|
Form wizard
|
||||||
===========
|
===========
|
||||||
|
@ -10,7 +8,7 @@ Form wizard
|
||||||
.. versionadded:: 1.0
|
.. versionadded:: 1.0
|
||||||
|
|
||||||
Django comes with an optional "form wizard" application that splits
|
Django comes with an optional "form wizard" application that splits
|
||||||
:ref:`forms <topics-forms-index>` across multiple Web pages. It maintains
|
:doc:`forms </topics/forms/index>` across multiple Web pages. It maintains
|
||||||
state in hashed HTML :samp:`<input type="hidden">` fields, and the data isn't
|
state in hashed HTML :samp:`<input type="hidden">` fields, and the data isn't
|
||||||
processed server-side until the final form is submitted.
|
processed server-side until the final form is submitted.
|
||||||
|
|
||||||
|
@ -65,8 +63,8 @@ Defining ``Form`` classes
|
||||||
|
|
||||||
The first step in creating a form wizard is to create the
|
The first step in creating a form wizard is to create the
|
||||||
:class:`~django.forms.Form` classes. These should be standard
|
:class:`~django.forms.Form` classes. These should be standard
|
||||||
:class:`django.forms.Form` classes, covered in the :ref:`forms documentation
|
:class:`django.forms.Form` classes, covered in the :doc:`forms documentation
|
||||||
<topics-forms-index>`. These classes can live anywhere in your codebase, but
|
</topics/forms/index>`. These classes can live anywhere in your codebase, but
|
||||||
convention is to put them in a file called :file:`forms.py` in your
|
convention is to put them in a file called :file:`forms.py` in your
|
||||||
application.
|
application.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-formtools-index:
|
|
||||||
|
|
||||||
django.contrib.formtools
|
django.contrib.formtools
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Spatial Backends
|
||||||
|
|
||||||
.. versionadded:: 1.2
|
.. versionadded:: 1.2
|
||||||
|
|
||||||
In Django 1.2, support for :ref:`multiple databases <topics-db-multi-db>` was
|
In Django 1.2, support for :doc:`multiple databases </topics/db/multi-db>` was
|
||||||
introduced. In order to support multiple databases, GeoDjango has segregated
|
introduced. In order to support multiple databases, GeoDjango has segregated
|
||||||
its functionality into full-fledged spatial database backends:
|
its functionality into full-fledged spatial database backends:
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ its functionality into full-fledged spatial database backends:
|
||||||
Database Settings Backwards-Compatibility
|
Database Settings Backwards-Compatibility
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
In :ref:`Django 1.2 <releases-1.2>`, the way
|
In :doc:`Django 1.2 </releases/1.2>`, the way
|
||||||
to :ref:`specify databases <specifying-databases>` in your settings was changed.
|
to :ref:`specify databases <specifying-databases>` in your settings was changed.
|
||||||
The old database settings format (e.g., the ``DATABASE_*`` settings)
|
The old database settings format (e.g., the ``DATABASE_*`` settings)
|
||||||
is backwards compatible with GeoDjango, and will automatically use the
|
is backwards compatible with GeoDjango, and will automatically use the
|
||||||
|
|
|
@ -54,7 +54,7 @@ Example::
|
||||||
number of ``processes`` instead.
|
number of ``processes`` instead.
|
||||||
|
|
||||||
For more information, please consult Django's
|
For more information, please consult Django's
|
||||||
:ref:`mod_wsgi documentation <howto-deployment-modwsgi>`.
|
:doc:`mod_wsgi documentation </howto/deployment/modwsgi>`.
|
||||||
|
|
||||||
``mod_python``
|
``mod_python``
|
||||||
--------------
|
--------------
|
||||||
|
@ -84,7 +84,7 @@ Example::
|
||||||
else your GeoDjango application may crash Apache.
|
else your GeoDjango application may crash Apache.
|
||||||
|
|
||||||
For more information, please consult Django's
|
For more information, please consult Django's
|
||||||
:ref:`mod_python documentation <howto-deployment-modpython>`.
|
:doc:`mod_python documentation </howto/deployment/modpython>`.
|
||||||
|
|
||||||
Lighttpd
|
Lighttpd
|
||||||
========
|
========
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-gis-feeds:
|
|
||||||
|
|
||||||
================
|
================
|
||||||
Geographic Feeds
|
Geographic Feeds
|
||||||
================
|
================
|
||||||
|
@ -10,8 +8,8 @@ Geographic Feeds
|
||||||
GeoDjango has its own :class:`Feed` subclass that may embed location information
|
GeoDjango has its own :class:`Feed` subclass that may embed location information
|
||||||
in RSS/Atom feeds formatted according to either the `Simple GeoRSS`__ or
|
in RSS/Atom feeds formatted according to either the `Simple GeoRSS`__ or
|
||||||
`W3C Geo`_ standards. Because GeoDjango's syndication API is a superset of
|
`W3C Geo`_ standards. Because GeoDjango's syndication API is a superset of
|
||||||
Django's, please consult `Django's syndication documentation <ref-contrib-syndication>`
|
Django's, please consult :doc:`Django's syndication documentation
|
||||||
for details on general usage.
|
</ref/contrib/syndication>` for details on general usage.
|
||||||
|
|
||||||
.. _W3C Geo: http://www.w3.org/2003/01/geo/
|
.. _W3C Geo: http://www.w3.org/2003/01/geo/
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ Django
|
||||||
------
|
------
|
||||||
|
|
||||||
Because GeoDjango is included with Django, please refer to Django's
|
Because GeoDjango is included with Django, please refer to Django's
|
||||||
:ref:`installation instructions <intro-install>` for details on how to install.
|
:doc:`installation instructions </intro/install>` for details on how to install.
|
||||||
|
|
||||||
.. _spatial_database:
|
.. _spatial_database:
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ Testing GeoDjango Apps
|
||||||
|
|
||||||
In Django 1.2, the addition of :ref:`spatial-backends`
|
In Django 1.2, the addition of :ref:`spatial-backends`
|
||||||
simplified the process of testing GeoDjango applications. Specifically, testing
|
simplified the process of testing GeoDjango applications. Specifically, testing
|
||||||
GeoDjango applications is now the same as :ref:`topics-testing`.
|
GeoDjango applications is now the same as :doc:`/topics/testing`.
|
||||||
|
|
||||||
Included in this documentation are some additional notes and settings
|
Included in this documentation are some additional notes and settings
|
||||||
for :ref:`testing-postgis` and :ref:`testing-spatialite` users.
|
for :ref:`testing-postgis` and :ref:`testing-spatialite` users.
|
||||||
|
|
|
@ -16,7 +16,7 @@ geographic web applications, like location-based services. Some features includ
|
||||||
* Editing of geometry fields inside the admin.
|
* Editing of geometry fields inside the admin.
|
||||||
|
|
||||||
This tutorial assumes a familiarity with Django; thus, if you're brand new to
|
This tutorial assumes a familiarity with Django; thus, if you're brand new to
|
||||||
Django please read through the :ref:`regular tutorial <intro-tutorial01>` to introduce
|
Django please read through the :doc:`regular tutorial </intro/tutorial01>` to introduce
|
||||||
yourself with basic Django concepts.
|
yourself with basic Django concepts.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
@ -682,8 +682,8 @@ Google
|
||||||
Geographic Admin
|
Geographic Admin
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
GeoDjango extends :ref:`Django's admin application <ref-contrib-admin>` to
|
GeoDjango extends :doc:`Django's admin application </ref/contrib/admin/index>`
|
||||||
enable support for editing geometry fields.
|
to enable support for editing geometry fields.
|
||||||
|
|
||||||
Basics
|
Basics
|
||||||
^^^^^^
|
^^^^^^
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-humanize:
|
|
||||||
|
|
||||||
========================
|
========================
|
||||||
django.contrib.humanize
|
django.contrib.humanize
|
||||||
========================
|
========================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-index:
|
|
||||||
|
|
||||||
====================
|
====================
|
||||||
``contrib`` packages
|
``contrib`` packages
|
||||||
====================
|
====================
|
||||||
|
@ -46,8 +44,8 @@ admin
|
||||||
=====
|
=====
|
||||||
|
|
||||||
The automatic Django administrative interface. For more information, see
|
The automatic Django administrative interface. For more information, see
|
||||||
:ref:`Tutorial 2 <intro-tutorial02>` and the
|
:doc:`Tutorial 2 </intro/tutorial02>` and the
|
||||||
:ref:`admin documentation <ref-contrib-admin>`.
|
:doc:`admin documentation </ref/contrib/admin/index>`.
|
||||||
|
|
||||||
Requires the auth_ and contenttypes_ contrib packages to be installed.
|
Requires the auth_ and contenttypes_ contrib packages to be installed.
|
||||||
|
|
||||||
|
@ -56,16 +54,16 @@ auth
|
||||||
|
|
||||||
Django's authentication framework.
|
Django's authentication framework.
|
||||||
|
|
||||||
See :ref:`topics-auth`.
|
See :doc:`/topics/auth`.
|
||||||
|
|
||||||
comments
|
comments
|
||||||
========
|
========
|
||||||
|
|
||||||
.. versionchanged:: 1.0
|
.. versionchanged:: 1.0
|
||||||
The comments application has been rewriten. See :ref:`ref-contrib-comments-upgrade`
|
The comments application has been rewriten. See :doc:`/ref/contrib/comments/upgrade`
|
||||||
for information on howto upgrade.
|
for information on howto upgrade.
|
||||||
|
|
||||||
A simple yet flexible comments system. See :ref:`ref-contrib-comments-index`.
|
A simple yet flexible comments system. See :doc:`/ref/contrib/comments/index`.
|
||||||
|
|
||||||
contenttypes
|
contenttypes
|
||||||
============
|
============
|
||||||
|
@ -73,21 +71,21 @@ contenttypes
|
||||||
A light framework for hooking into "types" of content, where each installed
|
A light framework for hooking into "types" of content, where each installed
|
||||||
Django model is a separate content type.
|
Django model is a separate content type.
|
||||||
|
|
||||||
See the :ref:`contenttypes documentation <ref-contrib-contenttypes>`.
|
See the :doc:`contenttypes documentation </ref/contrib/contenttypes>`.
|
||||||
|
|
||||||
csrf
|
csrf
|
||||||
====
|
====
|
||||||
|
|
||||||
A middleware for preventing Cross Site Request Forgeries
|
A middleware for preventing Cross Site Request Forgeries
|
||||||
|
|
||||||
See the :ref:`csrf documentation <ref-contrib-csrf>`.
|
See the :doc:`csrf documentation </ref/contrib/csrf>`.
|
||||||
|
|
||||||
flatpages
|
flatpages
|
||||||
=========
|
=========
|
||||||
|
|
||||||
A framework for managing simple "flat" HTML content in a database.
|
A framework for managing simple "flat" HTML content in a database.
|
||||||
|
|
||||||
See the :ref:`flatpages documentation <ref-contrib-flatpages>`.
|
See the :doc:`flatpages documentation </ref/contrib/flatpages>`.
|
||||||
|
|
||||||
Requires the sites_ contrib package to be installed as well.
|
Requires the sites_ contrib package to be installed as well.
|
||||||
|
|
||||||
|
@ -103,14 +101,14 @@ An abstraction of the following workflow:
|
||||||
|
|
||||||
"Display an HTML form, force a preview, then do something with the submission."
|
"Display an HTML form, force a preview, then do something with the submission."
|
||||||
|
|
||||||
See the :ref:`form preview documentation <ref-contrib-formtools-form-preview>`.
|
See the :doc:`form preview documentation </ref/contrib/formtools/form-preview>`.
|
||||||
|
|
||||||
django.contrib.formtools.wizard
|
django.contrib.formtools.wizard
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
Splits forms across multiple Web pages.
|
Splits forms across multiple Web pages.
|
||||||
|
|
||||||
See the :ref:`form wizard documentation <ref-contrib-formtools-form-wizard>`.
|
See the :doc:`form wizard documentation </ref/contrib/formtools/form-wizard>`.
|
||||||
|
|
||||||
gis
|
gis
|
||||||
====
|
====
|
||||||
|
@ -118,14 +116,14 @@ gis
|
||||||
A world-class geospatial framework built on top of Django, that enables
|
A world-class geospatial framework built on top of Django, that enables
|
||||||
storage, manipulation and display of spatial data.
|
storage, manipulation and display of spatial data.
|
||||||
|
|
||||||
See the :ref:`ref-contrib-gis` documentation for more.
|
See the :doc:`/ref/contrib/gis/index` documentation for more.
|
||||||
|
|
||||||
humanize
|
humanize
|
||||||
========
|
========
|
||||||
|
|
||||||
A set of Django template filters useful for adding a "human touch" to data.
|
A set of Django template filters useful for adding a "human touch" to data.
|
||||||
|
|
||||||
See the :ref:`humanize documentation <ref-contrib-humanize>`.
|
See the :doc:`humanize documentation </ref/contrib/humanize>`.
|
||||||
|
|
||||||
localflavor
|
localflavor
|
||||||
===========
|
===========
|
||||||
|
@ -134,7 +132,7 @@ A collection of various Django snippets that are useful only for a particular
|
||||||
country or culture. For example, ``django.contrib.localflavor.us.forms``
|
country or culture. For example, ``django.contrib.localflavor.us.forms``
|
||||||
contains a ``USZipCodeField`` that you can use to validate U.S. zip codes.
|
contains a ``USZipCodeField`` that you can use to validate U.S. zip codes.
|
||||||
|
|
||||||
See the :ref:`localflavor documentation <ref-contrib-localflavor>`.
|
See the :doc:`localflavor documentation </ref/contrib/localflavor>`.
|
||||||
|
|
||||||
.. _ref-contrib-markup:
|
.. _ref-contrib-markup:
|
||||||
|
|
||||||
|
@ -183,21 +181,21 @@ messages
|
||||||
A framework for storing and retrieving temporary cookie- or session-based
|
A framework for storing and retrieving temporary cookie- or session-based
|
||||||
messages
|
messages
|
||||||
|
|
||||||
See the :ref:`messages documentation <ref-contrib-messages>`.
|
See the :doc:`messages documentation </ref/contrib/messages>`.
|
||||||
|
|
||||||
redirects
|
redirects
|
||||||
=========
|
=========
|
||||||
|
|
||||||
A framework for managing redirects.
|
A framework for managing redirects.
|
||||||
|
|
||||||
See the :ref:`redirects documentation <ref-contrib-redirects>`.
|
See the :doc:`redirects documentation </ref/contrib/redirects>`.
|
||||||
|
|
||||||
sessions
|
sessions
|
||||||
========
|
========
|
||||||
|
|
||||||
A framework for storing data in anonymous sessions.
|
A framework for storing data in anonymous sessions.
|
||||||
|
|
||||||
See the :ref:`sessions documentation <topics-http-sessions>`.
|
See the :doc:`sessions documentation </topics/http/sessions>`.
|
||||||
|
|
||||||
sites
|
sites
|
||||||
=====
|
=====
|
||||||
|
@ -206,21 +204,21 @@ 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
|
database and Django installation. It gives you hooks for associating objects to
|
||||||
one or more sites.
|
one or more sites.
|
||||||
|
|
||||||
See the :ref:`sites documentation <ref-contrib-sites>`.
|
See the :doc:`sites documentation </ref/contrib/sites>`.
|
||||||
|
|
||||||
sitemaps
|
sitemaps
|
||||||
========
|
========
|
||||||
|
|
||||||
A framework for generating Google sitemap XML files.
|
A framework for generating Google sitemap XML files.
|
||||||
|
|
||||||
See the :ref:`sitemaps documentation <ref-contrib-sitemaps>`.
|
See the :doc:`sitemaps documentation </ref/contrib/sitemaps>`.
|
||||||
|
|
||||||
syndication
|
syndication
|
||||||
===========
|
===========
|
||||||
|
|
||||||
A framework for generating syndication feeds, in RSS and Atom, quite easily.
|
A framework for generating syndication feeds, in RSS and Atom, quite easily.
|
||||||
|
|
||||||
See the :ref:`syndication documentation <ref-contrib-syndication>`.
|
See the :doc:`syndication documentation </ref/contrib/syndication>`.
|
||||||
|
|
||||||
webdesign
|
webdesign
|
||||||
=========
|
=========
|
||||||
|
@ -228,7 +226,7 @@ webdesign
|
||||||
Helpers and utilities targeted primarily at Web *designers* rather than
|
Helpers and utilities targeted primarily at Web *designers* rather than
|
||||||
Web *developers*.
|
Web *developers*.
|
||||||
|
|
||||||
See the :ref:`Web design helpers documentation <ref-contrib-webdesign>`.
|
See the :doc:`Web design helpers documentation </ref/contrib/webdesign>`.
|
||||||
|
|
||||||
Other add-ons
|
Other add-ons
|
||||||
=============
|
=============
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-localflavor:
|
|
||||||
|
|
||||||
==========================
|
==========================
|
||||||
The "local flavor" add-ons
|
The "local flavor" add-ons
|
||||||
==========================
|
==========================
|
||||||
|
@ -17,7 +15,7 @@ Inside that package, country- or culture-specific code is organized into
|
||||||
subpackages, named using `ISO 3166 country codes`_.
|
subpackages, named using `ISO 3166 country codes`_.
|
||||||
|
|
||||||
Most of the ``localflavor`` add-ons are localized form components deriving
|
Most of the ``localflavor`` add-ons are localized form components deriving
|
||||||
from the :ref:`forms <topics-forms-index>` framework -- for example, a
|
from the :doc:`forms </topics/forms/index>` framework -- for example, a
|
||||||
:class:`~django.contrib.localflavor.us.forms.USStateField` that knows how to
|
:class:`~django.contrib.localflavor.us.forms.USStateField` that knows how to
|
||||||
validate U.S. state abbreviations, and a
|
validate U.S. state abbreviations, and a
|
||||||
:class:`~django.contrib.localflavor.fi.forms.FISocialSecurityNumber` that
|
:class:`~django.contrib.localflavor.fi.forms.FISocialSecurityNumber` that
|
||||||
|
@ -74,7 +72,7 @@ Countries currently supported by :mod:`~django.contrib.localflavor` are:
|
||||||
The ``django.contrib.localflavor`` package also includes a ``generic`` subpackage,
|
The ``django.contrib.localflavor`` package also includes a ``generic`` subpackage,
|
||||||
containing useful code that is not specific to one particular country or culture.
|
containing useful code that is not specific to one particular country or culture.
|
||||||
Currently, it defines date, datetime and split datetime input fields based on
|
Currently, it defines date, datetime and split datetime input fields based on
|
||||||
those from :ref:`forms <topics-forms-index>`, but with non-US default formats.
|
those from :doc:`forms </topics/forms/index>`, but with non-US default formats.
|
||||||
Here's an example of how to use them::
|
Here's an example of how to use them::
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-messages:
|
|
||||||
|
|
||||||
======================
|
======================
|
||||||
The messages framework
|
The messages framework
|
||||||
======================
|
======================
|
||||||
|
@ -20,8 +18,8 @@ with a specific ``level`` that determines its priority (e.g., ``info``,
|
||||||
Enabling messages
|
Enabling messages
|
||||||
=================
|
=================
|
||||||
|
|
||||||
Messages are implemented through a :ref:`middleware <ref-middleware>`
|
Messages are implemented through a :doc:`middleware </ref/middleware>`
|
||||||
class and corresponding :ref:`context processor <ref-templates-api>`.
|
class and corresponding :doc:`context processor </ref/templates/api>`.
|
||||||
|
|
||||||
To enable message functionality, do the following:
|
To enable message functionality, do the following:
|
||||||
|
|
||||||
|
@ -29,7 +27,7 @@ To enable message functionality, do the following:
|
||||||
it contains ``'django.contrib.messages.middleware.MessageMiddleware'``.
|
it contains ``'django.contrib.messages.middleware.MessageMiddleware'``.
|
||||||
|
|
||||||
If you are using a :ref:`storage backend <message-storage-backends>` that
|
If you are using a :ref:`storage backend <message-storage-backends>` that
|
||||||
relies on :ref:`sessions <topics-http-sessions>` (the default),
|
relies on :doc:`sessions </topics/http/sessions>` (the default),
|
||||||
``'django.contrib.sessions.middleware.SessionMiddleware'`` must be
|
``'django.contrib.sessions.middleware.SessionMiddleware'`` must be
|
||||||
enabled and appear before ``MessageMiddleware`` in your
|
enabled and appear before ``MessageMiddleware`` in your
|
||||||
:setting:`MIDDLEWARE_CLASSES`.
|
:setting:`MIDDLEWARE_CLASSES`.
|
||||||
|
@ -106,7 +104,7 @@ LegacyFallbackStorage
|
||||||
The ``LegacyFallbackStorage`` is a temporary tool to facilitate the transition
|
The ``LegacyFallbackStorage`` is a temporary tool to facilitate the transition
|
||||||
from the deprecated ``user.message_set`` API and will be removed in Django 1.4
|
from the deprecated ``user.message_set`` API and will be removed in Django 1.4
|
||||||
according to Django's standard deprecation policy. For more information, see
|
according to Django's standard deprecation policy. For more information, see
|
||||||
the full :ref:`release process documentation <internals-release-process>`.
|
the full :doc:`release process documentation </internals/release-process>`.
|
||||||
|
|
||||||
In addition to the functionality in the ``FallbackStorage``, it adds a custom,
|
In addition to the functionality in the ``FallbackStorage``, it adds a custom,
|
||||||
read-only storage class that retrieves messages from the user ``Message``
|
read-only storage class that retrieves messages from the user ``Message``
|
||||||
|
@ -300,7 +298,7 @@ example::
|
||||||
messages.info(request, 'Hello world.', fail_silently=True)
|
messages.info(request, 'Hello world.', fail_silently=True)
|
||||||
|
|
||||||
Internally, Django uses this functionality in the create, update, and delete
|
Internally, Django uses this functionality in the create, update, and delete
|
||||||
:ref:`generic views <topics-generic-views>` so that they work even if the
|
:doc:`generic views </topics/http/generic-views>` so that they work even if the
|
||||||
message framework is disabled.
|
message framework is disabled.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
@ -343,7 +341,7 @@ window/tab will have its own browsing context.
|
||||||
Settings
|
Settings
|
||||||
========
|
========
|
||||||
|
|
||||||
A few :ref:`Django settings <ref-settings>` give you control over message
|
A few :doc:`Django settings </ref/settings>` give you control over message
|
||||||
behavior:
|
behavior:
|
||||||
|
|
||||||
MESSAGE_LEVEL
|
MESSAGE_LEVEL
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-redirects:
|
|
||||||
|
|
||||||
=================
|
=================
|
||||||
The redirects app
|
The redirects app
|
||||||
=================
|
=================
|
||||||
|
@ -47,8 +45,8 @@ Note that the order of :setting:`MIDDLEWARE_CLASSES` matters. Generally, you
|
||||||
can put ``RedirectFallbackMiddleware`` at the end of the list, because it's a
|
can put ``RedirectFallbackMiddleware`` at the end of the list, because it's a
|
||||||
last resort.
|
last resort.
|
||||||
|
|
||||||
For more on middleware, read the :ref:`middleware docs
|
For more on middleware, read the :doc:`middleware docs
|
||||||
<topics-http-middleware>`.
|
</topics/http/middleware>`.
|
||||||
|
|
||||||
How to add, change and delete redirects
|
How to add, change and delete redirects
|
||||||
=======================================
|
=======================================
|
||||||
|
@ -65,8 +63,8 @@ Via the Python API
|
||||||
|
|
||||||
.. class:: models.Redirect
|
.. class:: models.Redirect
|
||||||
|
|
||||||
Redirects are represented by a standard :ref:`Django model <topics-db-models>`,
|
Redirects are represented by a standard :doc:`Django model </topics/db/models>`,
|
||||||
which lives in `django/contrib/redirects/models.py`_. You can access redirect
|
which lives in `django/contrib/redirects/models.py`_. You can access redirect
|
||||||
objects via the :ref:`Django database API <topics-db-queries>`.
|
objects via the :doc:`Django database API </topics/db/queries>`.
|
||||||
|
|
||||||
.. _django/contrib/redirects/models.py: http://code.djangoproject.com/browser/django/trunk/django/contrib/redirects/models.py
|
.. _django/contrib/redirects/models.py: http://code.djangoproject.com/browser/django/trunk/django/contrib/redirects/models.py
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-sitemaps:
|
|
||||||
|
|
||||||
=====================
|
=====================
|
||||||
The sitemap framework
|
The sitemap framework
|
||||||
=====================
|
=====================
|
||||||
|
@ -23,10 +21,10 @@ site.
|
||||||
The Django sitemap framework automates the creation of this XML file by letting
|
The Django sitemap framework automates the creation of this XML file by letting
|
||||||
you express this information in Python code.
|
you express this information in Python code.
|
||||||
|
|
||||||
It works much like Django's :ref:`syndication framework
|
It works much like Django's :doc:`syndication framework
|
||||||
<ref-contrib-syndication>`. To create a sitemap, just write a
|
</ref/contrib/syndication>`. To create a sitemap, just write a
|
||||||
:class:`~django.contrib.sitemaps.Sitemap` class and point to it in your
|
:class:`~django.contrib.sitemaps.Sitemap` class and point to it in your
|
||||||
:ref:`URLconf <topics-http-urls>`.
|
:doc:`URLconf </topics/http/urls>`.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
@ -52,7 +50,7 @@ Initialization
|
||||||
==============
|
==============
|
||||||
|
|
||||||
To activate sitemap generation on your Django site, add this line to your
|
To activate sitemap generation on your Django site, add this line to your
|
||||||
:ref:`URLconf <topics-http-urls>`::
|
:doc:`URLconf </topics/http/urls>`::
|
||||||
|
|
||||||
(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps})
|
(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps})
|
||||||
|
|
||||||
|
@ -227,7 +225,7 @@ The sitemap framework provides a couple convenience classes for common cases:
|
||||||
.. class:: GenericSitemap
|
.. class:: GenericSitemap
|
||||||
|
|
||||||
The :class:`django.contrib.sitemaps.GenericSitemap` class works with any
|
The :class:`django.contrib.sitemaps.GenericSitemap` class works with any
|
||||||
:ref:`generic views <ref-generic-views>` you already have.
|
:doc:`generic views </ref/generic-views>` you already have.
|
||||||
To use it, create an instance, passing in the same :data:`info_dict` you pass to
|
To use it, create an instance, passing in the same :data:`info_dict` you pass to
|
||||||
the generic views. The only requirement is that the dictionary have a
|
the generic views. The only requirement is that the dictionary have a
|
||||||
:data:`queryset` entry. It may also have a :data:`date_field` entry that specifies a
|
:data:`queryset` entry. It may also have a :data:`date_field` entry that specifies a
|
||||||
|
@ -240,7 +238,7 @@ The sitemap framework provides a couple convenience classes for common cases:
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Here's an example of a :ref:`URLconf <topics-http-urls>` using both::
|
Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
|
||||||
|
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls.defaults import *
|
||||||
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
|
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-sites:
|
|
||||||
|
|
||||||
=====================
|
=====================
|
||||||
The "sites" framework
|
The "sites" framework
|
||||||
=====================
|
=====================
|
||||||
|
@ -260,7 +258,7 @@ The ``CurrentSiteManager``
|
||||||
If :class:`~django.contrib.sites.models.Site` plays a key role in your
|
If :class:`~django.contrib.sites.models.Site` plays a key role in your
|
||||||
application, consider using the helpful
|
application, consider using the helpful
|
||||||
:class:`~django.contrib.sites.managers.CurrentSiteManager` in your
|
:class:`~django.contrib.sites.managers.CurrentSiteManager` in your
|
||||||
model(s). It's a model :ref:`manager <topics-db-managers>` that
|
model(s). It's a model :doc:`manager </topics/db/managers>` that
|
||||||
automatically filters its queries to include only objects associated
|
automatically filters its queries to include only objects associated
|
||||||
with the current :class:`~django.contrib.sites.models.Site`.
|
with the current :class:`~django.contrib.sites.models.Site`.
|
||||||
|
|
||||||
|
@ -322,7 +320,7 @@ and pass a field name that doesn't exist, Django will raise a :exc:`ValueError`.
|
||||||
Finally, note that you'll probably want to keep a normal
|
Finally, note that you'll probably want to keep a normal
|
||||||
(non-site-specific) ``Manager`` on your model, even if you use
|
(non-site-specific) ``Manager`` on your model, even if you use
|
||||||
:class:`~django.contrib.sites.managers.CurrentSiteManager`. As
|
:class:`~django.contrib.sites.managers.CurrentSiteManager`. As
|
||||||
explained in the :ref:`manager documentation <topics-db-managers>`, if
|
explained in the :doc:`manager documentation </topics/db/managers>`, if
|
||||||
you define a manager manually, then Django won't create the automatic
|
you define a manager manually, then Django won't create the automatic
|
||||||
``objects = models.Manager()`` manager for you. Also note that certain
|
``objects = models.Manager()`` manager for you. Also note that certain
|
||||||
parts of Django -- namely, the Django admin site and generic views --
|
parts of Django -- namely, the Django admin site and generic views --
|
||||||
|
@ -387,7 +385,7 @@ Here's how Django uses the sites framework:
|
||||||
|
|
||||||
.. versionadded:: 1.0
|
.. versionadded:: 1.0
|
||||||
|
|
||||||
Some :ref:`django.contrib <ref-contrib-index>` applications take advantage of
|
Some :doc:`django.contrib </ref/contrib/index>` applications take advantage of
|
||||||
the sites framework but are architected in a way that doesn't *require* the
|
the sites framework but are architected in a way that doesn't *require* the
|
||||||
sites framework to be installed in your database. (Some people don't want to, or
|
sites framework to be installed in your database. (Some people don't want to, or
|
||||||
just aren't *able* to install the extra database table that the sites framework
|
just aren't *able* to install the extra database table that the sites framework
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-syndication:
|
|
||||||
|
|
||||||
==============================
|
==============================
|
||||||
The syndication feed framework
|
The syndication feed framework
|
||||||
==============================
|
==============================
|
||||||
|
@ -38,8 +36,8 @@ Overview
|
||||||
The high-level feed-generating framework is supplied by the
|
The high-level feed-generating framework is supplied by the
|
||||||
:class:`~django.contrib.syndication.views.Feed` class. To create a
|
:class:`~django.contrib.syndication.views.Feed` class. To create a
|
||||||
feed, write a :class:`~django.contrib.syndication.views.Feed` class
|
feed, write a :class:`~django.contrib.syndication.views.Feed` class
|
||||||
and point to an instance of it in your :ref:`URLconf
|
and point to an instance of it in your :doc:`URLconf
|
||||||
<topics-http-urls>`.
|
</topics/http/urls>`.
|
||||||
|
|
||||||
Feed classes
|
Feed classes
|
||||||
------------
|
------------
|
||||||
|
@ -54,7 +52,7 @@ Feed classes subclass :class:`django.contrib.syndication.views.Feed`.
|
||||||
They can live anywhere in your codebase.
|
They can live anywhere in your codebase.
|
||||||
|
|
||||||
Instances of :class:`~django.contrib.syndication.views.Feed` classes
|
Instances of :class:`~django.contrib.syndication.views.Feed` classes
|
||||||
are views which can be used in your :ref:`URLconf <topics-http-urls>`.
|
are views which can be used in your :doc:`URLconf </topics/http/urls>`.
|
||||||
|
|
||||||
A simple example
|
A simple example
|
||||||
----------------
|
----------------
|
||||||
|
@ -80,7 +78,7 @@ latest five news items::
|
||||||
return item.description
|
return item.description
|
||||||
|
|
||||||
To connect a URL to this feed, put an instance of the Feed object in
|
To connect a URL to this feed, put an instance of the Feed object in
|
||||||
your :ref:`URLconf <topics-http-urls>`. For example::
|
your :doc:`URLconf </topics/http/urls>`. For example::
|
||||||
|
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls.defaults import *
|
||||||
from myproject.feeds import LatestEntriesFeed
|
from myproject.feeds import LatestEntriesFeed
|
||||||
|
@ -102,7 +100,7 @@ Note:
|
||||||
* :meth:`items()` is, simply, a method that returns a list of objects that
|
* :meth:`items()` is, simply, a method that returns a list of objects that
|
||||||
should be included in the feed as ``<item>`` elements. Although this
|
should be included in the feed as ``<item>`` elements. Although this
|
||||||
example returns ``NewsItem`` objects using Django's
|
example returns ``NewsItem`` objects using Django's
|
||||||
:ref:`object-relational mapper <ref-models-querysets>`, :meth:`items()`
|
:doc:`object-relational mapper </ref/models/querysets>`, :meth:`items()`
|
||||||
doesn't have to return model instances. Although you get a few bits of
|
doesn't have to return model instances. Although you get a few bits of
|
||||||
functionality "for free" by using Django models, :meth:`items()` can
|
functionality "for free" by using Django models, :meth:`items()` can
|
||||||
return any type of object you want.
|
return any type of object you want.
|
||||||
|
@ -123,7 +121,7 @@ into those elements.
|
||||||
both.
|
both.
|
||||||
|
|
||||||
If you want to do any special formatting for either the title or
|
If you want to do any special formatting for either the title or
|
||||||
description, :ref:`Django templates <topics-templates>` can be used
|
description, :doc:`Django templates </topics/templates>` can be used
|
||||||
instead. Their paths can be specified with the ``title_template`` and
|
instead. Their paths can be specified with the ``title_template`` and
|
||||||
``description_template`` attributes on the
|
``description_template`` attributes on the
|
||||||
:class:`~django.contrib.syndication.views.Feed` class. The templates are
|
:class:`~django.contrib.syndication.views.Feed` class. The templates are
|
||||||
|
@ -167,7 +165,7 @@ police beat in Chicago. It'd be silly to create a separate
|
||||||
:class:`~django.contrib.syndication.views.Feed` class for each police beat; that
|
:class:`~django.contrib.syndication.views.Feed` class for each police beat; that
|
||||||
would violate the :ref:`DRY principle <dry>` and would couple data to
|
would violate the :ref:`DRY principle <dry>` and would couple data to
|
||||||
programming logic. Instead, the syndication framework lets you access the
|
programming logic. Instead, the syndication framework lets you access the
|
||||||
arguments passed from your :ref:`URLconf <topics-http-urls>` so feeds can output
|
arguments passed from your :doc:`URLconf </topics/http/urls>` so feeds can output
|
||||||
items based on information in the feed's URL.
|
items based on information in the feed's URL.
|
||||||
|
|
||||||
On chicagocrime.org, the police-beat feeds are accessible via URLs like this:
|
On chicagocrime.org, the police-beat feeds are accessible via URLs like this:
|
||||||
|
@ -175,7 +173,7 @@ On chicagocrime.org, the police-beat feeds are accessible via URLs like this:
|
||||||
* :file:`/beats/613/rss/` -- Returns recent crimes for beat 613.
|
* :file:`/beats/613/rss/` -- Returns recent crimes for beat 613.
|
||||||
* :file:`/beats/1424/rss/` -- Returns recent crimes for beat 1424.
|
* :file:`/beats/1424/rss/` -- Returns recent crimes for beat 1424.
|
||||||
|
|
||||||
These can be matched with a :ref:`URLconf <topics-http-urls>` line such as::
|
These can be matched with a :doc:`URLconf </topics/http/urls>` line such as::
|
||||||
|
|
||||||
(r'^beats/(?P<beat_id>\d+)/rss/$', BeatFeed()),
|
(r'^beats/(?P<beat_id>\d+)/rss/$', BeatFeed()),
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-contrib-webdesign:
|
|
||||||
|
|
||||||
========================
|
========================
|
||||||
django.contrib.webdesign
|
django.contrib.webdesign
|
||||||
========================
|
========================
|
||||||
|
@ -9,13 +7,13 @@ django.contrib.webdesign
|
||||||
rather than Web *developers*.
|
rather than Web *developers*.
|
||||||
|
|
||||||
The ``django.contrib.webdesign`` package, part of the
|
The ``django.contrib.webdesign`` package, part of the
|
||||||
:ref:`"django.contrib" add-ons <ref-contrib-index>`, provides various Django
|
:doc:`"django.contrib" add-ons </ref/contrib/index>`, provides various Django
|
||||||
helpers that are particularly useful to Web *designers* (as opposed to
|
helpers that are particularly useful to Web *designers* (as opposed to
|
||||||
developers).
|
developers).
|
||||||
|
|
||||||
At present, the package contains only a single template tag. If you have ideas
|
At present, the package contains only a single template tag. If you have ideas
|
||||||
for Web-designer-friendly functionality in Django, please
|
for Web-designer-friendly functionality in Django, please
|
||||||
:ref:`suggest them <internals-contributing>`.
|
:doc:`suggest them </internals/contributing>`.
|
||||||
|
|
||||||
Template tags
|
Template tags
|
||||||
=============
|
=============
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-databases:
|
|
||||||
|
|
||||||
=========
|
=========
|
||||||
Databases
|
Databases
|
||||||
=========
|
=========
|
||||||
|
@ -50,7 +48,7 @@ aggregate with a database backend that falls within the affected release range.
|
||||||
Transaction handling
|
Transaction handling
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
:ref:`By default <topics-db-transactions>`, Django starts a transaction when a
|
:doc:`By default </topics/db/transactions>`, Django starts a transaction when a
|
||||||
database connection is first used and commits the result at the end of the
|
database connection is first used and commits the result at the end of the
|
||||||
request/response handling. The PostgreSQL backends normally operate the same
|
request/response handling. The PostgreSQL backends normally operate the same
|
||||||
as any other Django backend in this respect.
|
as any other Django backend in this respect.
|
||||||
|
@ -266,7 +264,7 @@ table (usually called ``django_session``) and the
|
||||||
Connecting to the database
|
Connecting to the database
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
Refer to the :ref:`settings documentation <ref-settings>`.
|
Refer to the :doc:`settings documentation </ref/settings>`.
|
||||||
|
|
||||||
Connection settings are used in this order:
|
Connection settings are used in this order:
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-django-admin:
|
|
||||||
|
|
||||||
=============================
|
=============================
|
||||||
django-admin.py and manage.py
|
django-admin.py and manage.py
|
||||||
=============================
|
=============================
|
||||||
|
@ -104,7 +102,7 @@ compilemessages
|
||||||
Before 1.0 this was the "bin/compile-messages.py" command.
|
Before 1.0 this was the "bin/compile-messages.py" command.
|
||||||
|
|
||||||
Compiles .po files created with ``makemessages`` to .mo files for use with
|
Compiles .po files created with ``makemessages`` to .mo files for use with
|
||||||
the builtin gettext support. See :ref:`topics-i18n`.
|
the builtin gettext support. See :doc:`/topics/i18n/index`.
|
||||||
|
|
||||||
Use the :djadminopt:`--locale`` option to specify the locale to process.
|
Use the :djadminopt:`--locale`` option to specify the locale to process.
|
||||||
If not provided, all locales are processed.
|
If not provided, all locales are processed.
|
||||||
|
@ -119,7 +117,7 @@ createcachetable
|
||||||
.. django-admin:: createcachetable
|
.. django-admin:: createcachetable
|
||||||
|
|
||||||
Creates a cache table named ``tablename`` for use with the database cache
|
Creates a cache table named ``tablename`` for use with the database cache
|
||||||
backend. See :ref:`topics-cache` for more information.
|
backend. See :doc:`/topics/cache` for more information.
|
||||||
|
|
||||||
.. versionadded:: 1.2
|
.. versionadded:: 1.2
|
||||||
|
|
||||||
|
@ -151,8 +149,8 @@ using the ``--username`` and ``--email`` arguments on the command
|
||||||
line. If either of those is not supplied, ``createsuperuser`` will prompt for
|
line. If either of those is not supplied, ``createsuperuser`` will prompt for
|
||||||
it when running interactively.
|
it when running interactively.
|
||||||
|
|
||||||
This command is only available if Django's :ref:`authentication system
|
This command is only available if Django's :doc:`authentication system
|
||||||
<topics-auth>` (``django.contrib.auth``) is installed.
|
</topics/auth>` (``django.contrib.auth``) is installed.
|
||||||
|
|
||||||
dbshell
|
dbshell
|
||||||
-------
|
-------
|
||||||
|
@ -529,8 +527,8 @@ runfcgi [options]
|
||||||
.. django-admin:: runfcgi
|
.. django-admin:: runfcgi
|
||||||
|
|
||||||
Starts a set of FastCGI processes suitable for use with any Web server that
|
Starts a set of FastCGI processes suitable for use with any Web server that
|
||||||
supports the FastCGI protocol. See the :ref:`FastCGI deployment documentation
|
supports the FastCGI protocol. See the :doc:`FastCGI deployment documentation
|
||||||
<howto-deployment-fastcgi>` for details. Requires the Python FastCGI module from
|
</howto/deployment/fastcgi>` for details. Requires the Python FastCGI module from
|
||||||
`flup`_.
|
`flup`_.
|
||||||
|
|
||||||
.. _flup: http://www.saddi.com/software/flup/
|
.. _flup: http://www.saddi.com/software/flup/
|
||||||
|
@ -616,7 +614,7 @@ Serving static files with the development server
|
||||||
|
|
||||||
By default, the development server doesn't serve any static files for your site
|
By default, the development server doesn't serve any static files for your site
|
||||||
(such as CSS files, images, things under ``MEDIA_URL`` and so forth). If
|
(such as CSS files, images, things under ``MEDIA_URL`` and so forth). If
|
||||||
you want to configure Django to serve static media, read :ref:`howto-static-files`.
|
you want to configure Django to serve static media, read :doc:`/howto/static-files`.
|
||||||
|
|
||||||
shell
|
shell
|
||||||
-----
|
-----
|
||||||
|
@ -822,7 +820,7 @@ test <app or test identifier>
|
||||||
|
|
||||||
.. django-admin:: test
|
.. django-admin:: test
|
||||||
|
|
||||||
Runs tests for all installed models. See :ref:`topics-testing` for more
|
Runs tests for all installed models. See :doc:`/topics/testing` for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
.. versionadded:: 1.2
|
.. versionadded:: 1.2
|
||||||
|
@ -847,7 +845,7 @@ For example, this command::
|
||||||
|
|
||||||
...would perform the following steps:
|
...would perform the following steps:
|
||||||
|
|
||||||
1. Create a test database, as described in :ref:`topics-testing`.
|
1. Create a test database, as described in :doc:`/topics/testing`.
|
||||||
2. Populate the test database with fixture data from the given fixtures.
|
2. Populate the test database with fixture data from the given fixtures.
|
||||||
(For more on fixtures, see the documentation for ``loaddata`` above.)
|
(For more on fixtures, see the documentation for ``loaddata`` above.)
|
||||||
3. Runs the Django development server (as in ``runserver``), pointed at
|
3. Runs the Django development server (as in ``runserver``), pointed at
|
||||||
|
@ -855,7 +853,7 @@ For example, this command::
|
||||||
|
|
||||||
This is useful in a number of ways:
|
This is useful in a number of ways:
|
||||||
|
|
||||||
* When you're writing :ref:`unit tests <topics-testing>` of how your views
|
* When you're writing :doc:`unit tests </topics/testing>` of how your views
|
||||||
act with certain fixture data, you can use ``testserver`` to interact with
|
act with certain fixture data, you can use ``testserver`` to interact with
|
||||||
the views in a Web browser, manually.
|
the views in a Web browser, manually.
|
||||||
|
|
||||||
|
@ -1116,4 +1114,4 @@ distribution. It enables tab-completion of ``django-admin.py`` and
|
||||||
with ``sql``.
|
with ``sql``.
|
||||||
|
|
||||||
|
|
||||||
See :ref:`howto-custom-management-commands` for how to add customized actions.
|
See :doc:`/howto/custom-management-commands` for how to add customized actions.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-exceptions:
|
|
||||||
|
|
||||||
=================
|
=================
|
||||||
Django Exceptions
|
Django Exceptions
|
||||||
=================
|
=================
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-files-file:
|
|
||||||
|
|
||||||
The ``File`` object
|
The ``File`` object
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
@ -20,14 +18,14 @@ Django's ``File`` has the following attributes and methods:
|
||||||
|
|
||||||
The absolute path to the file's location on a local filesystem.
|
The absolute path to the file's location on a local filesystem.
|
||||||
|
|
||||||
:ref:`Custom file storage systems <howto-custom-file-storage>` may not store
|
:doc:`Custom file storage systems </howto/custom-file-storage>` may not store
|
||||||
files locally; files stored on these systems will have a ``path`` of
|
files locally; files stored on these systems will have a ``path`` of
|
||||||
``None``.
|
``None``.
|
||||||
|
|
||||||
.. attribute:: File.url
|
.. attribute:: File.url
|
||||||
|
|
||||||
The URL where the file can be retrieved. This is often useful in
|
The URL where the file can be retrieved. This is often useful in
|
||||||
:ref:`templates <topics-templates>`; for example, a bit of a template for
|
:doc:`templates </topics/templates>`; for example, a bit of a template for
|
||||||
displaying a ``Car`` (see above) might look like:
|
displaying a ``Car`` (see above) might look like:
|
||||||
|
|
||||||
.. code-block:: html+django
|
.. code-block:: html+django
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-files-index:
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
File handling
|
File handling
|
||||||
=============
|
=============
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-files-storage:
|
|
||||||
|
|
||||||
File storage API
|
File storage API
|
||||||
================
|
================
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-forms-api:
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
The Forms API
|
The Forms API
|
||||||
=============
|
=============
|
||||||
|
@ -11,7 +9,7 @@ The Forms API
|
||||||
.. admonition:: About this document
|
.. admonition:: About this document
|
||||||
|
|
||||||
This document covers the gritty details of Django's forms API. You should
|
This document covers the gritty details of Django's forms API. You should
|
||||||
read the :ref:`introduction to working with forms <topics-forms-index>`
|
read the :doc:`introduction to working with forms </topics/forms/index>`
|
||||||
first.
|
first.
|
||||||
|
|
||||||
.. _ref-forms-api-bound-unbound:
|
.. _ref-forms-api-bound-unbound:
|
||||||
|
@ -262,7 +260,7 @@ for each field in the "Built-in ``Field`` classes" section below.
|
||||||
|
|
||||||
You can write code to perform validation for particular form fields (based on
|
You can write code to perform validation for particular form fields (based on
|
||||||
their name) or for the form as a whole (considering combinations of various
|
their name) or for the form as a whole (considering combinations of various
|
||||||
fields). More information about this is in :ref:`ref-forms-validation`.
|
fields). More information about this is in :doc:`/ref/forms/validation`.
|
||||||
|
|
||||||
Outputting forms as HTML
|
Outputting forms as HTML
|
||||||
------------------------
|
------------------------
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-forms-fields:
|
|
||||||
|
|
||||||
===========
|
===========
|
||||||
Form fields
|
Form fields
|
||||||
===========
|
===========
|
||||||
|
@ -192,7 +190,7 @@ The callable will be evaluated only when the unbound form is displayed, not when
|
||||||
.. attribute:: Field.widget
|
.. attribute:: Field.widget
|
||||||
|
|
||||||
The ``widget`` argument lets you specify a ``Widget`` class to use when
|
The ``widget`` argument lets you specify a ``Widget`` class to use when
|
||||||
rendering this ``Field``. See :ref:`ref-forms-widgets` for more information.
|
rendering this ``Field``. See :doc:`/ref/forms/widgets` for more information.
|
||||||
|
|
||||||
``help_text``
|
``help_text``
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
@ -267,7 +265,7 @@ error message keys it uses.
|
||||||
The ``validators`` argument lets you provide a list of validation functions
|
The ``validators`` argument lets you provide a list of validation functions
|
||||||
for this field.
|
for this field.
|
||||||
|
|
||||||
See the :ref:`validators documentation <ref-validators>` for more information.
|
See the :doc:`validators documentation </ref/validators>` for more information.
|
||||||
|
|
||||||
``localize``
|
``localize``
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
@ -516,8 +514,8 @@ given length.
|
||||||
* Validates that non-empty file data has been bound to the form.
|
* Validates that non-empty file data has been bound to the form.
|
||||||
* Error message keys: ``required``, ``invalid``, ``missing``, ``empty``
|
* Error message keys: ``required``, ``invalid``, ``missing``, ``empty``
|
||||||
|
|
||||||
To learn more about the ``UploadedFile`` object, see the :ref:`file uploads
|
To learn more about the ``UploadedFile`` object, see the :doc:`file uploads
|
||||||
documentation <topics-http-file-uploads>`.
|
documentation </topics/http/file-uploads>`.
|
||||||
|
|
||||||
When you use a ``FileField`` in a form, you must also remember to
|
When you use a ``FileField`` in a form, you must also remember to
|
||||||
:ref:`bind the file data to the form <binding-uploaded-files>`.
|
:ref:`bind the file data to the form <binding-uploaded-files>`.
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
.. _ref-forms-index:
|
|
||||||
|
|
||||||
=====
|
=====
|
||||||
Forms
|
Forms
|
||||||
=====
|
=====
|
||||||
|
|
||||||
Detailed form API reference. For introductory material, see :ref:`topics-forms-index`.
|
Detailed form API reference. For introductory material, see :doc:`/topics/forms/index`.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-forms-validation:
|
|
||||||
|
|
||||||
Form and field validation
|
Form and field validation
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-forms-widgets:
|
|
||||||
|
|
||||||
=======
|
=======
|
||||||
Widgets
|
Widgets
|
||||||
=======
|
=======
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-generic-views:
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
Generic views
|
Generic views
|
||||||
=============
|
=============
|
||||||
|
@ -9,8 +7,8 @@ again and again. In Django, the most common of these patterns have been
|
||||||
abstracted into "generic views" that let you quickly provide common views of
|
abstracted into "generic views" that let you quickly provide common views of
|
||||||
an object without actually needing to write any Python code.
|
an object without actually needing to write any Python code.
|
||||||
|
|
||||||
A general introduction to generic views can be found in the :ref:`topic guide
|
A general introduction to generic views can be found in the :doc:`topic guide
|
||||||
<topics-generic-views>`.
|
</topics/http/generic-views>`.
|
||||||
|
|
||||||
This reference contains details of Django's built-in generic views, along with
|
This reference contains details of Django's built-in generic views, along with
|
||||||
a list of all keyword arguments that a generic view expects. Remember that
|
a list of all keyword arguments that a generic view expects. Remember that
|
||||||
|
@ -18,7 +16,7 @@ arguments may either come from the URL pattern or from the ``extra_context``
|
||||||
additional-information dictionary.
|
additional-information dictionary.
|
||||||
|
|
||||||
Most generic views require the ``queryset`` key, which is a ``QuerySet``
|
Most generic views require the ``queryset`` key, which is a ``QuerySet``
|
||||||
instance; see :ref:`topics-db-queries` for more information about ``QuerySet``
|
instance; see :doc:`/topics/db/queries` for more information about ``QuerySet``
|
||||||
objects.
|
objects.
|
||||||
|
|
||||||
"Simple" generic views
|
"Simple" generic views
|
||||||
|
@ -766,8 +764,8 @@ specify the page number in the URL in one of two ways:
|
||||||
These values and lists are 1-based, not 0-based, so the first page would be
|
These values and lists are 1-based, not 0-based, so the first page would be
|
||||||
represented as page ``1``.
|
represented as page ``1``.
|
||||||
|
|
||||||
For more on pagination, read the :ref:`pagination documentation
|
For more on pagination, read the :doc:`pagination documentation
|
||||||
<topics-pagination>`.
|
</topics/pagination>`.
|
||||||
|
|
||||||
.. versionadded:: 1.0
|
.. versionadded:: 1.0
|
||||||
|
|
||||||
|
@ -858,8 +856,8 @@ for creating, editing and deleting objects.
|
||||||
.. versionchanged:: 1.0
|
.. versionchanged:: 1.0
|
||||||
|
|
||||||
``django.views.generic.create_update.create_object`` and
|
``django.views.generic.create_update.create_object`` and
|
||||||
``django.views.generic.create_update.update_object`` now use the new :ref:`forms
|
``django.views.generic.create_update.update_object`` now use the new :doc:`forms
|
||||||
library <topics-forms-index>` to build and display the form.
|
library </topics/forms/index>` to build and display the form.
|
||||||
|
|
||||||
``django.views.generic.create_update.create_object``
|
``django.views.generic.create_update.create_object``
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
|
@ -875,7 +873,7 @@ validation errors (if there are any) and saving the object.
|
||||||
|
|
||||||
If you provide ``form_class``, it should be a ``django.forms.ModelForm``
|
If you provide ``form_class``, it should be a ``django.forms.ModelForm``
|
||||||
subclass. Use this argument when you need to customize the model's form.
|
subclass. Use this argument when you need to customize the model's form.
|
||||||
See the :ref:`ModelForm docs <topics-forms-modelforms>` for more
|
See the :doc:`ModelForm docs </topics/forms/modelforms>` for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
Otherwise, ``model`` should be a Django model class and the form used
|
Otherwise, ``model`` should be a Django model class and the form used
|
||||||
|
@ -892,7 +890,7 @@ validation errors (if there are any) and saving the object.
|
||||||
|
|
||||||
* ``login_required``: A boolean that designates whether a user must be
|
* ``login_required``: A boolean that designates whether a user must be
|
||||||
logged in, in order to see the page and save changes. This hooks into the
|
logged in, in order to see the page and save changes. This hooks into the
|
||||||
Django :ref:`authentication system <topics-auth>`. By default, this is
|
Django :doc:`authentication system </topics/auth>`. By default, this is
|
||||||
``False``.
|
``False``.
|
||||||
|
|
||||||
If this is ``True``, and a non-logged-in user attempts to visit this page
|
If this is ``True``, and a non-logged-in user attempts to visit this page
|
||||||
|
@ -932,7 +930,7 @@ In addition to ``extra_context``, the template's context will be:
|
||||||
<p>{{ form.address.label_tag }} {{ form.address }}</p>
|
<p>{{ form.address.label_tag }} {{ form.address }}</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
See the :ref:`forms documentation <topics-forms-index>` for more
|
See the :doc:`forms documentation </topics/forms/index>` for more
|
||||||
information about using ``Form`` objects in templates.
|
information about using ``Form`` objects in templates.
|
||||||
|
|
||||||
``django.views.generic.create_update.update_object``
|
``django.views.generic.create_update.update_object``
|
||||||
|
@ -951,7 +949,7 @@ model class.
|
||||||
|
|
||||||
If you provide ``form_class``, it should be a ``django.forms.ModelForm``
|
If you provide ``form_class``, it should be a ``django.forms.ModelForm``
|
||||||
subclass. Use this argument when you need to customize the model's form.
|
subclass. Use this argument when you need to customize the model's form.
|
||||||
See the :ref:`ModelForm docs <topics-forms-modelforms>` for more
|
See the :doc:`ModelForm docs </topics/forms/modelforms>` for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
Otherwise, ``model`` should be a Django model class and the form used
|
Otherwise, ``model`` should be a Django model class and the form used
|
||||||
|
@ -977,7 +975,7 @@ model class.
|
||||||
|
|
||||||
* ``login_required``: A boolean that designates whether a user must be
|
* ``login_required``: A boolean that designates whether a user must be
|
||||||
logged in, in order to see the page and save changes. This hooks into the
|
logged in, in order to see the page and save changes. This hooks into the
|
||||||
Django :ref:`authentication system <topics-auth>`. By default, this is
|
Django :doc:`authentication system </topics/auth>`. By default, this is
|
||||||
``False``.
|
``False``.
|
||||||
|
|
||||||
If this is ``True``, and a non-logged-in user attempts to visit this page
|
If this is ``True``, and a non-logged-in user attempts to visit this page
|
||||||
|
@ -1020,7 +1018,7 @@ In addition to ``extra_context``, the template's context will be:
|
||||||
<p>{{ form.address.label_tag }} {{ form.address }}</p>
|
<p>{{ form.address.label_tag }} {{ form.address }}</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
See the :ref:`forms documentation <topics-forms-index>` for more
|
See the :doc:`forms documentation </topics/forms/index>` for more
|
||||||
information about using ``Form`` objects in templates.
|
information about using ``Form`` objects in templates.
|
||||||
|
|
||||||
* ``object``: The original object being edited. This variable's name
|
* ``object``: The original object being edited. This variable's name
|
||||||
|
@ -1059,7 +1057,7 @@ contain a form that POSTs to the same URL.
|
||||||
|
|
||||||
* ``login_required``: A boolean that designates whether a user must be
|
* ``login_required``: A boolean that designates whether a user must be
|
||||||
logged in, in order to see the page and save changes. This hooks into the
|
logged in, in order to see the page and save changes. This hooks into the
|
||||||
Django :ref:`authentication system <topics-auth>`. By default, this is
|
Django :doc:`authentication system </topics/auth>`. By default, this is
|
||||||
``False``.
|
``False``.
|
||||||
|
|
||||||
If this is ``True``, and a non-logged-in user attempts to visit this page
|
If this is ``True``, and a non-logged-in user attempts to visit this page
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-index:
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
API Reference
|
API Reference
|
||||||
=============
|
=============
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.. _ref-middleware:
|
|
||||||
|
|
||||||
==========
|
==========
|
||||||
Middleware
|
Middleware
|
||||||
==========
|
==========
|
||||||
|
@ -9,7 +7,7 @@ Middleware
|
||||||
|
|
||||||
This document explains all middleware components that come with Django. For
|
This document explains all middleware components that come with Django. For
|
||||||
information on how how to use them and how to write your own middleware, see
|
information on how how to use them and how to write your own middleware, see
|
||||||
the :ref:`middleware usage guide <topics-http-middleware>`.
|
the :doc:`middleware usage guide </topics/http/middleware>`.
|
||||||
|
|
||||||
Available middleware
|
Available middleware
|
||||||
====================
|
====================
|
||||||
|
@ -26,7 +24,7 @@ Cache middleware
|
||||||
|
|
||||||
Enable the site-wide cache. If these are enabled, each Django-powered page will
|
Enable the site-wide cache. If these are enabled, each Django-powered page will
|
||||||
be cached for as long as the :setting:`CACHE_MIDDLEWARE_SECONDS` setting
|
be cached for as long as the :setting:`CACHE_MIDDLEWARE_SECONDS` setting
|
||||||
defines. See the :ref:`cache documentation <topics-cache>`.
|
defines. See the :doc:`cache documentation </topics/cache>`.
|
||||||
|
|
||||||
"Common" middleware
|
"Common" middleware
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -136,8 +134,8 @@ Locale middleware
|
||||||
.. class:: django.middleware.locale.LocaleMiddleware
|
.. class:: django.middleware.locale.LocaleMiddleware
|
||||||
|
|
||||||
Enables language selection based on data from the request. It customizes
|
Enables language selection based on data from the request. It customizes
|
||||||
content for each user. See the :ref:`internationalization documentation
|
content for each user. See the :doc:`internationalization documentation
|
||||||
<topics-i18n>`.
|
</topics/i18n/index>`.
|
||||||
|
|
||||||
Message middleware
|
Message middleware
|
||||||
------------------
|
------------------
|
||||||
|
@ -151,7 +149,7 @@ Message middleware
|
||||||
``MessageMiddleware`` was added.
|
``MessageMiddleware`` was added.
|
||||||
|
|
||||||
Enables cookie- and session-based message support. See the
|
Enables cookie- and session-based message support. See the
|
||||||
:ref:`messages documentation <ref-contrib-messages>`.
|
:doc:`messages documentation </ref/contrib/messages>`.
|
||||||
|
|
||||||
Session middleware
|
Session middleware
|
||||||
------------------
|
------------------
|
||||||
|
@ -161,8 +159,8 @@ Session middleware
|
||||||
|
|
||||||
.. class:: django.contrib.sessions.middleware.SessionMiddleware
|
.. class:: django.contrib.sessions.middleware.SessionMiddleware
|
||||||
|
|
||||||
Enables session support. See the :ref:`session documentation
|
Enables session support. See the :doc:`session documentation
|
||||||
<topics-http-sessions>`.
|
</topics/http/sessions>`.
|
||||||
|
|
||||||
Authentication middleware
|
Authentication middleware
|
||||||
-------------------------
|
-------------------------
|
||||||
|
@ -173,8 +171,8 @@ Authentication middleware
|
||||||
.. class:: django.contrib.auth.middleware.AuthenticationMiddleware
|
.. class:: django.contrib.auth.middleware.AuthenticationMiddleware
|
||||||
|
|
||||||
Adds the ``user`` attribute, representing the currently-logged-in user, to
|
Adds the ``user`` attribute, representing the currently-logged-in user, to
|
||||||
every incoming ``HttpRequest`` object. See :ref:`Authentication in Web requests
|
every incoming ``HttpRequest`` object. See :doc:`Authentication in Web requests
|
||||||
<topics-auth>`.
|
</topics/auth>`.
|
||||||
|
|
||||||
CSRF protection middleware
|
CSRF protection middleware
|
||||||
--------------------------
|
--------------------------
|
||||||
|
@ -189,7 +187,7 @@ CSRF protection middleware
|
||||||
|
|
||||||
Adds protection against Cross Site Request Forgeries by adding hidden form
|
Adds protection against Cross Site Request Forgeries by adding hidden form
|
||||||
fields to POST forms and checking requests for the correct value. See the
|
fields to POST forms and checking requests for the correct value. See the
|
||||||
:ref:`Cross Site Request Forgery protection documentation <ref-contrib-csrf>`.
|
:doc:`Cross Site Request Forgery protection documentation </ref/contrib/csrf>`.
|
||||||
|
|
||||||
Transaction middleware
|
Transaction middleware
|
||||||
----------------------
|
----------------------
|
||||||
|
@ -208,4 +206,4 @@ running outside of it run with commit-on-save - the default Django behavior.
|
||||||
Middleware modules running inside it (coming later in the stack) will be under
|
Middleware modules running inside it (coming later in the stack) will be under
|
||||||
the same transaction control as the view functions.
|
the same transaction control as the view functions.
|
||||||
|
|
||||||
See the :ref:`transaction management documentation <topics-db-transactions>`.
|
See the :doc:`transaction management documentation </topics/db/transactions>`.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue