Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #19516 - Fixed remaining broken links.

Added -n to sphinx builds to catch issues going forward.
  • Loading branch information...
commit 9b5f64cc6ed5f1e904093fe4e6ff0f681b8e545f 1 parent 3f890f8
@timgraham timgraham authored
Showing with 729 additions and 613 deletions.
  1. +1 −1  docs/Makefile
  2. +5 −4 docs/faq/usage.txt
  3. +9 −9 docs/howto/custom-model-fields.txt
  4. +6 −0 docs/howto/custom-template-tags.txt
  5. +3 −3 docs/internals/contributing/writing-code/coding-style.txt
  6. +9 −11 docs/internals/deprecation.txt
  7. +2 −2 docs/intro/tutorial01.txt
  8. +4 −4 docs/intro/tutorial04.txt
  9. +1 −1  docs/make.bat
  10. +18 −16 docs/ref/class-based-views/base.txt
  11. +39 −39 docs/ref/class-based-views/flattened-index.txt
  12. +1 −1  docs/ref/class-based-views/generic-date-based.txt
  13. +20 −20 docs/ref/class-based-views/generic-display.txt
  14. +5 −5 docs/ref/class-based-views/generic-editing.txt
  15. +5 −4 docs/ref/class-based-views/mixins-date-based.txt
  16. +26 −17 docs/ref/class-based-views/mixins-editing.txt
  17. +10 −12 docs/ref/class-based-views/mixins-multiple-object.txt
  18. +5 −7 docs/ref/class-based-views/mixins-simple.txt
  19. +20 −21 docs/ref/class-based-views/mixins-single-object.txt
  20. +4 −4 docs/ref/clickjacking.txt
  21. +1 −1  docs/ref/contrib/admin/admindocs.txt
  22. +12 −14 docs/ref/contrib/admin/index.txt
  23. +14 −12 docs/ref/contrib/comments/custom.txt
  24. +2 −2 docs/ref/contrib/comments/example.txt
  25. +4 −5 docs/ref/contrib/comments/moderation.txt
  26. +2 −2 docs/ref/contrib/comments/signals.txt
  27. +7 −1 docs/ref/contrib/contenttypes.txt
  28. +2 −2 docs/ref/contrib/flatpages.txt
  29. +8 −8 docs/ref/contrib/formtools/form-preview.txt
  30. +21 −11 docs/ref/contrib/formtools/form-wizard.txt
  31. +2 −0  docs/ref/contrib/formtools/index.txt
  32. +10 −7 docs/ref/contrib/gis/db-api.txt
  33. +5 −5 docs/ref/contrib/gis/feeds.txt
  34. +2 −2 docs/ref/contrib/gis/geoquerysets.txt
  35. +10 −4 docs/ref/contrib/gis/geos.txt
  36. +1 −1  docs/ref/contrib/gis/install/index.txt
  37. +7 −7 docs/ref/contrib/gis/tutorial.txt
  38. +17 −12 docs/ref/contrib/sitemaps.txt
  39. +5 −5 docs/ref/contrib/staticfiles.txt
  40. +1 −1  docs/ref/contrib/syndication.txt
  41. +2 −2 docs/ref/databases.txt
  42. +2 −0  docs/ref/django-admin.txt
  43. +15 −0 docs/ref/exceptions.txt
  44. +2 −2 docs/ref/files/file.txt
  45. +1 −1  docs/ref/files/storage.txt
  46. +21 −20 docs/ref/forms/api.txt
  47. +6 −6 docs/ref/forms/widgets.txt
  48. +2 −2 docs/ref/middleware.txt
  49. +58 −35 docs/ref/models/fields.txt
  50. +1 −1  docs/ref/models/options.txt
  51. +1 −1  docs/ref/request-response.txt
  52. +1 −1  docs/ref/settings.txt
  53. +5 −6 docs/ref/signals.txt
  54. +11 −13 docs/ref/template-response.txt
  55. +19 −3 docs/ref/templates/api.txt
  56. +1 −1  docs/ref/templates/builtins.txt
  57. +0 −2  docs/ref/urls.txt
  58. +9 −10 docs/ref/utils.txt
  59. +1 −1  docs/ref/validators.txt
  60. +1 −1  docs/releases/1.2-beta-1.txt
  61. +5 −5 docs/releases/1.2.txt
  62. +1 −1  docs/releases/1.3-alpha-1.txt
  63. +3 −3 docs/releases/1.3-beta-1.txt
  64. +2 −3 docs/releases/1.3.txt
  65. +1 −1  docs/releases/1.4-alpha-1.txt
  66. +1 −1  docs/releases/1.4-beta-1.txt
  67. +2 −2 docs/releases/1.4.txt
  68. +9 −9 docs/topics/auth/passwords.txt
  69. +5 −3 docs/topics/cache.txt
  70. +6 −6 docs/topics/class-based-views/generic-display.txt
  71. +46 −35 docs/topics/class-based-views/generic-editing.txt
  72. +100 −92 docs/topics/class-based-views/mixins.txt
  73. +2 −3 docs/topics/db/sql.txt
  74. +3 −4 docs/topics/db/transactions.txt
  75. +2 −0  docs/topics/forms/formsets.txt
  76. +2 −2 docs/topics/http/file-uploads.txt
  77. +2 −0  docs/topics/http/views.txt
  78. +2 −2 docs/topics/i18n/timezones.txt
  79. +6 −6 docs/topics/logging.txt
  80. +35 −38 docs/topics/python3.txt
  81. +3 −1 docs/topics/serialization.txt
  82. +2 −1  docs/topics/settings.txt
  83. +4 −4 docs/topics/testing/overview.txt
View
2  docs/Makefile
@@ -10,7 +10,7 @@ BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
View
9 docs/faq/usage.txt
@@ -52,10 +52,11 @@ Using a :class:`~django.db.models.FileField` or an
#. All that will be stored in your database is a path to the file
(relative to :setting:`MEDIA_ROOT`). You'll most likely want to use the
- convenience :attr:`~django.core.files.File.url` attribute provided by
- Django. For example, if your :class:`~django.db.models.ImageField` is
- called ``mug_shot``, you can get the absolute path to your image in a
- template with ``{{ object.mug_shot.url }}``.
+ convenience :attr:`~django.db.models.fields.files.FieldFile.url` attribute
+ provided by Django. For example, if your
+ :class:`~django.db.models.ImageField` is called ``mug_shot``, you can get
+ the absolute path to your image in a template with
+ ``{{ object.mug_shot.url }}``.
How do I make a variable available to all my templates?
-------------------------------------------------------
View
18 docs/howto/custom-model-fields.txt
@@ -199,20 +199,20 @@ The :meth:`~django.db.models.Field.__init__` method takes the following
parameters:
* :attr:`~django.db.models.Field.verbose_name`
-* :attr:`~django.db.models.Field.name`
+* ``name``
* :attr:`~django.db.models.Field.primary_key`
-* :attr:`~django.db.models.Field.max_length`
+* :attr:`~django.db.models.CharField.max_length`
* :attr:`~django.db.models.Field.unique`
* :attr:`~django.db.models.Field.blank`
* :attr:`~django.db.models.Field.null`
* :attr:`~django.db.models.Field.db_index`
-* :attr:`~django.db.models.Field.rel`: Used for related fields (like
- :class:`ForeignKey`). For advanced use only.
+* ``rel``: Used for related fields (like :class:`ForeignKey`). For advanced
+ use only.
* :attr:`~django.db.models.Field.default`
* :attr:`~django.db.models.Field.editable`
-* :attr:`~django.db.models.Field.serialize`: If ``False``, the field will
- not be serialized when the model is passed to Django's :doc:`serializers
- </topics/serialization>`. Defaults to ``True``.
+* ``serialize``: If ``False``, the field will not be serialized when the model
+ is passed to Django's :doc:`serializers </topics/serialization>`. Defaults to
+ ``True``.
* :attr:`~django.db.models.Field.unique_for_date`
* :attr:`~django.db.models.Field.unique_for_month`
* :attr:`~django.db.models.Field.unique_for_year`
@@ -222,7 +222,7 @@ parameters:
* :attr:`~django.db.models.Field.db_tablespace`: Only for index creation, if the
backend supports :doc:`tablespaces </topics/db/tablespaces>`. You can usually
ignore this option.
-* :attr:`~django.db.models.Field.auto_created`: True if the field was
+* ``auto_created``: True if the field was
automatically created, as for the `OneToOneField` used by model
inheritance. For advanced use only.
@@ -443,7 +443,7 @@ Python object type we want to store in the model's attribute. If anything is
going wrong during value conversion, you should raise a
:exc:`~django.core.exceptions.ValidationError` exception.
-**Remember:** If your custom field needs the :meth:`to_python` method to be
+**Remember:** If your custom field needs the :meth:`.to_python` method to be
called when it is created, you should be using `The SubfieldBase metaclass`_
mentioned earlier. Otherwise :meth:`.to_python` won't be called
automatically.
View
6 docs/howto/custom-template-tags.txt
@@ -114,6 +114,8 @@ your function. Example:
Registering custom filters
~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. method:: django.template.Library.filter
+
Once you've written your filter definition, you need to register it with
your ``Library`` instance, to make it available to Django's template language:
@@ -151,6 +153,8 @@ are described in :ref:`filters and auto-escaping <filters-auto-escaping>` and
Template filters that expect strings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. method:: django.template.defaultfilters.stringfilter
+
If you're writing a template filter that only expects a string as the first
argument, you should use the decorator ``stringfilter``. This will
convert an object to its string value before being passed to your function:
@@ -700,6 +704,8 @@ cannot resolve the string passed to it in the current context of the page.
Simple tags
~~~~~~~~~~~
+.. method:: django.template.Library.simple_tag
+
Many template tags take a number of arguments -- strings or template variables
-- and return a string after doing some processing based solely on
the input arguments and some external information. For example, the
View
6 docs/internals/contributing/writing-code/coding-style.txt
@@ -177,9 +177,9 @@ That means that the ability for third parties to import the module at the top
level is incompatible with the ability to configure the settings object
manually, or makes it very difficult in some circumstances.
-Instead of the above code, a level of laziness or indirection must be used, such
-as :class:`django.utils.functional.LazyObject`,
-:func:`django.utils.functional.lazy` or ``lambda``.
+Instead of the above code, a level of laziness or indirection must be used,
+such as ``django.utils.functional.LazyObject``,
+``django.utils.functional.lazy()`` or ``lambda``.
Miscellaneous
-------------
View
20 docs/internals/deprecation.txt
@@ -167,9 +167,8 @@ these changes.
* ``django.core.context_processors.PermWrapper`` and
``django.core.context_processors.PermLookupDict`` will be removed in
favor of the corresponding
- :class:`django.contrib.auth.context_processors.PermWrapper` and
- :class:`django.contrib.auth.context_processors.PermLookupDict`,
- respectively.
+ ``django.contrib.auth.context_processors.PermWrapper`` and
+ ``django.contrib.auth.context_processors.PermLookupDict``, respectively.
* The :setting:`MEDIA_URL` or :setting:`STATIC_URL` settings will be
required to end with a trailing slash to ensure there is a consistent
@@ -218,10 +217,10 @@ these changes.
synonym for ``django.views.decorators.csrf.csrf_exempt``, which should
be used to replace it.
-* The :class:`~django.core.cache.backends.memcached.CacheClass` backend
+* The ``django.core.cache.backends.memcached.CacheClass`` backend
was split into two in Django 1.3 in order to introduce support for
- PyLibMC. The historical :class:`~django.core.cache.backends.memcached.CacheClass`
- will be removed in favor of :class:`~django.core.cache.backends.memcached.MemcachedCache`.
+ PyLibMC. The historical ``CacheClass`` will be removed in favor of
+ ``django.core.cache.backends.memcached.MemcachedCache``.
* The UK-prefixed objects of ``django.contrib.localflavor.uk`` will only
be accessible through their GB-prefixed names (GB is the correct
@@ -243,8 +242,8 @@ these changes.
:setting:`LOGGING` setting should include this filter explicitly if
it is desired.
-* The builtin truncation functions :func:`django.utils.text.truncate_words`
- and :func:`django.utils.text.truncate_html_words` will be removed in
+* The builtin truncation functions ``django.utils.text.truncate_words()``
+ and ``django.utils.text.truncate_html_words()`` will be removed in
favor of the ``django.utils.text.Truncator`` class.
* The :class:`~django.contrib.gis.geoip.GeoIP` class was moved to
@@ -257,9 +256,8 @@ these changes.
:data:`~django.conf.urls.handler500`, are now available through
:mod:`django.conf.urls` .
-* The functions :func:`~django.core.management.setup_environ` and
- :func:`~django.core.management.execute_manager` will be removed from
- :mod:`django.core.management`. This also means that the old (pre-1.4)
+* The functions ``setup_environ()`` and ``execute_manager()`` will be removed
+ from :mod:`django.core.management`. This also means that the old (pre-1.4)
style of :file:`manage.py` file will no longer work.
* Setting the ``is_safe`` and ``needs_autoescape`` flags as attributes of
View
4 docs/intro/tutorial01.txt
@@ -369,8 +369,8 @@ its human-readable name.
Some :class:`~django.db.models.Field` classes have required elements.
:class:`~django.db.models.CharField`, for example, requires that you give it a
-:attr:`~django.db.models.Field.max_length`. That's used not only in the database
-schema, but in validation, as we'll soon see.
+:attr:`~django.db.models.CharField.max_length`. That's used not only in the
+database schema, but in validation, as we'll soon see.
Finally, note a relationship is defined, using
:class:`~django.db.models.ForeignKey`. That tells Django each ``Choice`` is related
View
8 docs/intro/tutorial04.txt
@@ -234,12 +234,12 @@ two views abstract the concepts of "display a list of objects" and
* Each generic view needs to know what model it will be acting
upon. This is provided using the ``model`` parameter.
-* The :class:`~django.views.generic.list.DetailView` generic view
+* The :class:`~django.views.generic.detail.DetailView` generic view
expects the primary key value captured from the URL to be called
``"pk"``, so we've changed ``poll_id`` to ``pk`` for the generic
views.
-By default, the :class:`~django.views.generic.list.DetailView` generic
+By default, the :class:`~django.views.generic.detail.DetailView` generic
view uses a template called ``<app name>/<model name>_detail.html``.
In our case, it'll use the template ``"polls/poll_detail.html"``. The
``template_name`` argument is used to tell Django to use a specific
@@ -247,7 +247,7 @@ template name instead of the autogenerated default template name. We
also specify the ``template_name`` for the ``results`` list view --
this ensures that the results view and the detail view have a
different appearance when rendered, even though they're both a
-:class:`~django.views.generic.list.DetailView` behind the scenes.
+:class:`~django.views.generic.detail.DetailView` behind the scenes.
Similarly, the :class:`~django.views.generic.list.ListView` generic
view uses a default template called ``<app name>/<model
@@ -257,7 +257,7 @@ name>_list.html``; we use ``template_name`` to tell
In previous parts of the tutorial, the templates have been provided
with a context that contains the ``poll`` and ``latest_poll_list``
-context variables. For DetailView the ``poll`` variable is provided
+context variables. For ``DetailView`` the ``poll`` variable is provided
automatically -- since we're using a Django model (``Poll``), Django
is able to determine an appropriate name for the context variable.
However, for ListView, the automatically generated context variable is
View
2  docs/make.bat
@@ -6,7 +6,7 @@ if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
-set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set ALLSPHINXOPTS=-n -d %BUILDDIR%/doctrees %SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
View
34 docs/ref/class-based-views/base.txt
@@ -49,9 +49,13 @@ View
**Attributes**
- .. attribute:: http_method_names = ['get', 'post', 'put', 'delete', 'head', 'options', 'trace']
+ .. attribute:: http_method_names
- The default list of HTTP method names that this view will accept.
+ The list of HTTP method names that this view will accept.
+
+ Default::
+
+ ['get', 'post', 'put', 'delete', 'head', 'options', 'trace']
**Methods**
@@ -68,12 +72,11 @@ View
The default implementation will inspect the HTTP method and attempt to
delegate to a method that matches the HTTP method; a ``GET`` will be
- delegated to :meth:`~View.get()`, a ``POST`` to :meth:`~View.post()`,
- and so on.
+ delegated to ``get()``, a ``POST`` to ``post()``, and so on.
- By default, a ``HEAD`` request will be delegated to :meth:`~View.get()`.
+ By default, a ``HEAD`` request will be delegated to ``get()``.
If you need to handle ``HEAD`` requests in a different way than ``GET``,
- you can override the :meth:`~View.head()` method. See
+ you can override the ``head()`` method. See
:ref:`supporting-other-http-methods` for an example.
The default implementation also sets ``request``, ``args`` and
@@ -111,9 +114,9 @@ TemplateView
**Method Flowchart**
- 1. :meth:`dispatch()`
- 2. :meth:`http_method_not_allowed()`
- 3. :meth:`get_context_data()`
+ 1. :meth:`~django.views.generic.base.View.dispatch()`
+ 2. :meth:`~django.views.generic.base.View.http_method_not_allowed()`
+ 3. :meth:`~django.views.generic.base.ContextMixin.get_context_data()`
**Example views.py**::
@@ -169,8 +172,8 @@ RedirectView
**Method Flowchart**
- 1. :meth:`dispatch()`
- 2. :meth:`http_method_not_allowed()`
+ 1. :meth:`~django.views.generic.base.View.dispatch()`
+ 2. :meth:`~django.views.generic.base.View.http_method_not_allowed()`
3. :meth:`get_redirect_url()`
**Example views.py**::
@@ -230,9 +233,8 @@ RedirectView
Constructs the target URL for redirection.
- The default implementation uses :attr:`~RedirectView.url` as a starting
+ The default implementation uses :attr:`url` as a starting
string, performs expansion of ``%`` parameters in that string, as well
- as the appending of query string if requested by
- :attr:`~RedirectView.query_string`. Subclasses may implement any
- behavior they wish, as long as the method returns a redirect-ready URL
- string.
+ as the appending of query string if requested by :attr:`query_string`.
+ Subclasses may implement any behavior they wish, as long as the method
+ returns a redirect-ready URL string.
View
78 docs/ref/class-based-views/flattened-index.txt
@@ -23,7 +23,7 @@ View
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
TemplateView
@@ -40,9 +40,9 @@ TemplateView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.base.TemplateView.get`
-* :meth:`~django.views.generic.base.TemplateView.get_context_data`
-* :meth:`~django.views.generic.base.View.head`
+* ``get()``
+* :meth:`~django.views.generic.base.ContextMixin.get_context_data`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -60,15 +60,15 @@ RedirectView
**Methods**
* :meth:`~django.views.generic.base.View.as_view`
-* :meth:`~django.views.generic.base.RedirectView.delete`
+* ``delete()``
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.base.RedirectView.get`
+* ``get()``
* :meth:`~django.views.generic.base.RedirectView.get_redirect_url`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
-* :meth:`~django.views.generic.base.RedirectView.options`
-* :meth:`~django.views.generic.base.RedirectView.post`
-* :meth:`~django.views.generic.base.RedirectView.put`
+* ``options()``
+* ``post()``
+* ``put()``
Detail Views
------------
@@ -95,10 +95,10 @@ DetailView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.detail.BaseDetailView.get`
+* ``get()``
* :meth:`~django.views.generic.detail.SingleObjectMixin.get_context_data`
* :meth:`~django.views.generic.detail.SingleObjectMixin.get_object`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -130,7 +130,7 @@ ListView
* :meth:`~django.views.generic.list.BaseListView.get`
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_data`
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_paginator`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.list.MultipleObjectMixin.paginate_queryset`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -161,10 +161,10 @@ FormView
* :meth:`~django.views.generic.edit.FormMixin.get_context_data`
* :meth:`~django.views.generic.edit.FormMixin.get_form`
* :meth:`~django.views.generic.edit.FormMixin.get_form_kwargs`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
-* :meth:`~django.views.generic.edit.ProcessFormView.post`
-* :meth:`~django.views.generic.edit.ProcessFormView.put`
+* ``post()``
+* ``put()``
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
CreateView
@@ -199,10 +199,10 @@ CreateView
* :meth:`~django.views.generic.edit.FormMixin.get_form`
* :meth:`~django.views.generic.edit.FormMixin.get_form_kwargs`
* :meth:`~django.views.generic.detail.SingleObjectMixin.get_object`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.edit.ProcessFormView.post`
-* :meth:`~django.views.generic.edit.ProcessFormView.put`
+* ``put()``
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
UpdateView
@@ -237,10 +237,10 @@ UpdateView
* :meth:`~django.views.generic.edit.FormMixin.get_form`
* :meth:`~django.views.generic.edit.FormMixin.get_form_kwargs`
* :meth:`~django.views.generic.detail.SingleObjectMixin.get_object`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.edit.ProcessFormView.post`
-* :meth:`~django.views.generic.edit.ProcessFormView.put`
+* ``put()``
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
DeleteView
@@ -265,14 +265,14 @@ DeleteView
**Methods**
* :meth:`~django.views.generic.base.View.as_view`
-* :meth:`~django.views.generic.edit.DeletionMixin.delete`
+* ``delete()``
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.detail.BaseDetailView.get`
+* ``get()``
* :meth:`~django.views.generic.detail.SingleObjectMixin.get_context_data`
* :meth:`~django.views.generic.detail.SingleObjectMixin.get_object`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
-* :meth:`~django.views.generic.edit.DeletionMixin.post`
+* ``post()``
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
Date-based views
@@ -302,13 +302,13 @@ ArchiveIndexView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.dates.BaseDateListView.get`
+* ``get()``
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_data`
* :meth:`~django.views.generic.dates.BaseDateListView.get_date_list`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_items`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_queryset`
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_paginator`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.list.MultipleObjectMixin.paginate_queryset`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -324,7 +324,7 @@ YearArchiveView
* :attr:`~django.views.generic.list.MultipleObjectMixin.context_object_name` [:meth:`~django.views.generic.list.MultipleObjectMixin.get_context_object_name`]
* :attr:`~django.views.generic.dates.DateMixin.date_field` [:meth:`~django.views.generic.dates.DateMixin.get_date_field`]
* :attr:`~django.views.generic.base.View.http_method_names`
-* :attr:`~django.views.generic.dates.BaseYearArchiveView.make_object_list` [:meth:`~django.views.generic.dates.BaseYearArchiveView.get_make_object_list`]
+* :attr:`~django.views.generic.dates.YearArchiveView.make_object_list` [:meth:`~django.views.generic.dates.YearArchiveView.get_make_object_list`]
* :attr:`~django.views.generic.list.MultipleObjectMixin.model`
* :attr:`~django.views.generic.list.MultipleObjectMixin.paginate_by` [:meth:`~django.views.generic.list.MultipleObjectMixin.get_paginate_by`]
* :attr:`~django.views.generic.list.MultipleObjectMixin.paginate_orphans` [:meth:`~django.views.generic.list.MultipleObjectMixin.get_paginate_orphans`]
@@ -340,13 +340,13 @@ YearArchiveView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.dates.BaseDateListView.get`
+* ``get()``
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_data`
* :meth:`~django.views.generic.dates.BaseDateListView.get_date_list`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_items`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_queryset`
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_paginator`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.list.MultipleObjectMixin.paginate_queryset`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -379,7 +379,7 @@ MonthArchiveView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.dates.BaseDateListView.get`
+* ``get()``
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_data`
* :meth:`~django.views.generic.dates.BaseDateListView.get_date_list`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_items`
@@ -387,7 +387,7 @@ MonthArchiveView
* :meth:`~django.views.generic.dates.MonthMixin.get_next_month`
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_paginator`
* :meth:`~django.views.generic.dates.MonthMixin.get_previous_month`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.list.MultipleObjectMixin.paginate_queryset`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -420,13 +420,13 @@ WeekArchiveView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.dates.BaseDateListView.get`
+* ``get()``
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_data`
* :meth:`~django.views.generic.dates.BaseDateListView.get_date_list`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_items`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_queryset`
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_paginator`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.list.MultipleObjectMixin.paginate_queryset`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -461,7 +461,7 @@ DayArchiveView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.dates.BaseDateListView.get`
+* ``get()``
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_data`
* :meth:`~django.views.generic.dates.BaseDateListView.get_date_list`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_items`
@@ -471,7 +471,7 @@ DayArchiveView
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_paginator`
* :meth:`~django.views.generic.dates.DayMixin.get_previous_day`
* :meth:`~django.views.generic.dates.MonthMixin.get_previous_month`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.list.MultipleObjectMixin.paginate_queryset`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -506,7 +506,7 @@ TodayArchiveView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.dates.BaseDateListView.get`
+* ``get()``
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_data`
* :meth:`~django.views.generic.dates.BaseDateListView.get_date_list`
* :meth:`~django.views.generic.dates.BaseDateListView.get_dated_items`
@@ -516,7 +516,7 @@ TodayArchiveView
* :meth:`~django.views.generic.list.MultipleObjectMixin.get_paginator`
* :meth:`~django.views.generic.dates.DayMixin.get_previous_day`
* :meth:`~django.views.generic.dates.MonthMixin.get_previous_month`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.list.MultipleObjectMixin.paginate_queryset`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
@@ -551,13 +551,13 @@ DateDetailView
* :meth:`~django.views.generic.base.View.as_view`
* :meth:`~django.views.generic.base.View.dispatch`
-* :meth:`~django.views.generic.detail.BaseDetailView.get`
+* ``get()``
* :meth:`~django.views.generic.detail.SingleObjectMixin.get_context_data`
* :meth:`~django.views.generic.dates.DayMixin.get_next_day`
* :meth:`~django.views.generic.dates.MonthMixin.get_next_month`
* :meth:`~django.views.generic.detail.SingleObjectMixin.get_object`
* :meth:`~django.views.generic.dates.DayMixin.get_previous_day`
* :meth:`~django.views.generic.dates.MonthMixin.get_previous_month`
-* :meth:`~django.views.generic.base.View.head`
+* ``head()``
* :meth:`~django.views.generic.base.View.http_method_not_allowed`
* :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response`
View
2  docs/ref/class-based-views/generic-date-based.txt
@@ -580,7 +580,7 @@ DateDetailView
* :class:`django.views.generic.dates.MonthMixin`
* :class:`django.views.generic.dates.DayMixin`
* :class:`django.views.generic.dates.DateMixin`
- * :class:`django.views.generic.detail.BaseDetailView`
+ * ``django.views.generic.detail.BaseDetailView``
* :class:`django.views.generic.detail.SingleObjectMixin`
* :class:`django.views.generic.base.View`
View
40 docs/ref/class-based-views/generic-display.txt
@@ -19,22 +19,22 @@ DetailView
* :class:`django.views.generic.detail.SingleObjectTemplateResponseMixin`
* :class:`django.views.generic.base.TemplateResponseMixin`
- * :class:`django.views.generic.detail.BaseDetailView`
+ * ``django.views.generic.detail.BaseDetailView``
* :class:`django.views.generic.detail.SingleObjectMixin`
* :class:`django.views.generic.base.View`
**Method Flowchart**
- 1. :meth:`dispatch()`
- 2. :meth:`http_method_not_allowed()`
- 3. :meth:`get_template_names()`
- 4. :meth:`get_slug_field()`
- 5. :meth:`get_queryset()`
- 6. :meth:`get_object()`
- 7. :meth:`get_context_object_name()`
- 8. :meth:`get_context_data()`
- 9. :meth:`get()`
- 10. :meth:`render_to_response()`
+ 1. :meth:`~django.views.generic.base.View.dispatch()`
+ 2. :meth:`~django.views.generic.base.View.http_method_not_allowed()`
+ 3. :meth:`~django.views.generic.base.TemplateResponseMixin.get_template_names()`
+ 4. :meth:`~django.views.generic.detail.SingleObjectMixin.get_slug_field()`
+ 5. :meth:`~django.views.generic.detail.SingleObjectMixin.get_queryset()`
+ 6. :meth:`~django.views.generic.detail.SingleObjectMixin.get_object()`
+ 7. :meth:`~django.views.generic.detail.SingleObjectMixin.get_context_object_name()`
+ 8. :meth:`~django.views.generic.detail.SingleObjectMixin.get_context_data()`
+ 9. ``get()``
+ 10. :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response()`
**Example views.py**::
@@ -86,14 +86,14 @@ ListView
**Method Flowchart**
- 1. :meth:`dispatch()`
- 2. :meth:`http_method_not_allowed()`
- 3. :meth:`get_template_names()`
- 4. :meth:`get_queryset()`
- 5. :meth:`get_objects()`
- 6. :meth:`get_context_data()`
- 7. :meth:`get()`
- 8. :meth:`render_to_response()`
+ 1. :meth:`~django.views.generic.base.View.dispatch()`
+ 2. :meth:`~django.views.generic.base.View.http_method_not_allowed()`
+ 3. :meth:`~django.views.generic.base.TemplateResponseMixin.get_template_names()`
+ 4. :meth:`~django.views.generic.list.MultipleObjectMixin.get_queryset()`
+ 5. :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_object_name()`
+ 6. :meth:`~django.views.generic.list.MultipleObjectMixin.get_context_data()`
+ 7. ``get()``
+ 8. :meth:`~django.views.generic.base.TemplateResponseMixin.render_to_response()`
**Example views.py**::
@@ -140,7 +140,7 @@ ListView
.. method:: get(request, *args, **kwargs)
- Adds :attr:`object_list` to the context. If
+ Adds ``object_list`` to the context. If
:attr:`~django.views.generic.list.MultipleObjectMixin.allow_empty`
is True then display an empty list. If
:attr:`~django.views.generic.list.MultipleObjectMixin.allow_empty` is
View
10 docs/ref/class-based-views/generic-editing.txt
@@ -38,7 +38,7 @@ FormView
* :class:`django.views.generic.edit.FormView`
* :class:`django.views.generic.base.TemplateResponseMixin`
- * :class:`django.views.generic.edit.BaseFormView`
+ * ``django.views.generic.edit.BaseFormView``
* :class:`django.views.generic.edit.FormMixin`
* :class:`django.views.generic.edit.ProcessFormView`
* :class:`django.views.generic.base.View`
@@ -86,7 +86,7 @@ CreateView
* :class:`django.views.generic.edit.CreateView`
* :class:`django.views.generic.detail.SingleObjectTemplateResponseMixin`
* :class:`django.views.generic.base.TemplateResponseMixin`
- * :class:`django.views.generic.edit.BaseCreateView`
+ * ``django.views.generic.edit.BaseCreateView``
* :class:`django.views.generic.edit.ModelFormMixin`
* :class:`django.views.generic.edit.FormMixin`
* :class:`django.views.generic.detail.SingleObjectMixin`
@@ -128,7 +128,7 @@ UpdateView
* :class:`django.views.generic.edit.UpdateView`
* :class:`django.views.generic.detail.SingleObjectTemplateResponseMixin`
* :class:`django.views.generic.base.TemplateResponseMixin`
- * :class:`django.views.generic.edit.BaseUpdateView`
+ * ``django.views.generic.edit.BaseUpdateView``
* :class:`django.views.generic.edit.ModelFormMixin`
* :class:`django.views.generic.edit.FormMixin`
* :class:`django.views.generic.detail.SingleObjectMixin`
@@ -170,9 +170,9 @@ DeleteView
* :class:`django.views.generic.edit.DeleteView`
* :class:`django.views.generic.detail.SingleObjectTemplateResponseMixin`
* :class:`django.views.generic.base.TemplateResponseMixin`
- * :class:`django.views.generic.edit.BaseDeleteView`
+ * ``django.views.generic.edit.BaseDeleteView``
* :class:`django.views.generic.edit.DeletionMixin`
- * :class:`django.views.generic.detail.BaseDetailView`
+ * ``django.views.generic.detail.BaseDetailView``
* :class:`django.views.generic.detail.SingleObjectMixin`
* :class:`django.views.generic.base.View`
View
9 docs/ref/class-based-views/mixins-date-based.txt
@@ -100,7 +100,7 @@ MonthMixin
:attr:`~BaseDateListView.allow_empty` and
:attr:`~DateMixin.allow_future`.
- .. method:: get_prev_month(date)
+ .. method:: get_previous_month(date)
Returns a date object containing the first day of the month before the
date provided. This function can also return ``None`` or raise an
@@ -152,7 +152,7 @@ DayMixin
:attr:`~BaseDateListView.allow_empty` and
:attr:`~DateMixin.allow_future`.
- .. method:: get_prev_day(date)
+ .. method:: get_previous_day(date)
Returns a date object containing the previous valid day. This function
can also return ``None`` or raise an :class:`~django.http.Http404`
@@ -287,8 +287,9 @@ BaseDateListView
available. If this is ``True`` and no objects are available, the view
will display an empty page instead of raising a 404.
- This is identical to :attr:`MultipleObjectMixin.allow_empty`, except
- for the default value, which is ``False``.
+ This is identical to
+ :attr:`django.views.generic.list.MultipleObjectMixin.allow_empty`,
+ except for the default value, which is ``False``.
.. attribute:: date_list_period
View
43 docs/ref/class-based-views/mixins-editing.txt
@@ -83,9 +83,8 @@ FormMixin
.. note::
- Views mixing :class:`FormMixin` must provide an implementation of
- :meth:`~django.views.generic.FormMixin.form_valid` and
- :meth:`~django.views.generic.FormMixin.form_invalid`.
+ Views mixing ``FormMixin`` must provide an implementation of
+ :meth:`form_valid` and :meth:`form_invalid`.
ModelFormMixin
@@ -93,15 +92,16 @@ ModelFormMixin
.. class:: django.views.generic.edit.ModelFormMixin
- A form mixin that works on ModelForms, rather than a standalone form.
+ A form mixin that works on ``ModelForms``, rather than a standalone form.
Since this is a subclass of
:class:`~django.views.generic.detail.SingleObjectMixin`, instances of this
- mixin have access to the :attr:`~SingleObjectMixin.model` and
- :attr:`~SingleObjectMixin.queryset` attributes, describing the type of
- object that the ModelForm is manipulating. The view also provides
- ``self.object``, the instance being manipulated. If the instance is being
- created, ``self.object`` will be ``None``.
+ mixin have access to the
+ :attr:`~django.views.generic.detail.SingleObjectMixin.model` and
+ :attr:`~django.views.generic.detail.SingleObjectMixin.queryset` attributes,
+ describing the type of object that the ``ModelForm`` is manipulating. The
+ view also provides ``self.object``, the instance being manipulated. If the
+ instance is being created, ``self.object`` will be ``None``.
**Mixins**
@@ -110,6 +110,12 @@ ModelFormMixin
**Methods and Attributes**
+ .. attribute:: model
+
+ A model class. Can be explicitly provided, otherwise will be determined
+ by examining ``self.object`` or
+ :attr:`~django.views.generic.detail.SingleObjectMixin.queryset`.
+
.. attribute:: success_url
The URL to redirect to when the form is successfully processed.
@@ -122,22 +128,25 @@ ModelFormMixin
.. method:: get_form_class()
Retrieve the form class to instantiate. If
- :attr:`FormMixin.form_class` is provided, that class will be used.
- Otherwise, a ModelForm will be instantiated using the model associated
- with the :attr:`~SingleObjectMixin.queryset`, or with the
- :attr:`~SingleObjectMixin.model`, depending on which attribute is
- provided.
+ :attr:`~django.views.generic.edit.FormMixin.form_class` is provided,
+ that class will be used. Otherwise, a ``ModelForm`` will be
+ instantiated using the model associated with the
+ :attr:`~django.views.generic.detail.SingleObjectMixin.queryset`, or
+ with the :attr:`~django.views.generic.detail.SingleObjectMixin.model`,
+ depending on which attribute is provided.
.. method:: get_form_kwargs()
Add the current instance (``self.object``) to the standard
- :meth:`FormMixin.get_form_kwargs`.
+ :meth:`~django.views.generic.edit.FormMixin.get_form_kwargs`.
.. method:: get_success_url()
Determine the URL to redirect to when the form is successfully
- validated. Returns :attr:`ModelFormMixin.success_url` if it is provided;
- otherwise, attempts to use the ``get_absolute_url()`` of the object.
+ validated. Returns
+ :attr:`django.views.generic.edit.ModelFormMixin.success_url` if it is
+ provided; otherwise, attempts to use the ``get_absolute_url()`` of the
+ object.
.. method:: form_valid(form)
View
22 docs/ref/class-based-views/mixins-multiple-object.txt
@@ -61,14 +61,13 @@ MultipleObjectMixin
.. attribute:: queryset
A ``QuerySet`` that represents the objects. If provided, the value of
- :attr:`MultipleObjectMixin.queryset` supersedes the value provided for
- :attr:`MultipleObjectMixin.model`.
+ ``queryset`` supersedes the value provided for :attr:`model`.
.. attribute:: paginate_by
An integer specifying how many objects should be displayed per page. If
this is given, the view will paginate objects with
- :attr:`MultipleObjectMixin.paginate_by` objects per page. The view will
+ ``paginate_by`` objects per page. The view will
expect either a ``page`` query string parameter (via ``request.GET``)
or a ``page`` variable specified in the URLconf.
@@ -77,10 +76,9 @@ MultipleObjectMixin
.. versionadded:: 1.6
An integer specifying the number of "overflow" objects the last page
- can contain. This extends the :attr:`MultipleObjectMixin.paginate_by`
- limit on the last page by up to
- :attr:`MultipleObjectMixin.paginate_orphans`, in order to keep the last
- page from having a very small number of objects.
+ can contain. This extends the :attr:`paginate_by` limit on the last
+ page by up to ``paginate_orphans``, in order to keep the last page from
+ having a very small number of objects.
.. attribute:: page_kwarg
@@ -97,7 +95,7 @@ MultipleObjectMixin
:class:`django.core.paginator.Paginator` is used. If the custom paginator
class doesn't have the same constructor interface as
:class:`django.core.paginator.Paginator`, you will also need to
- provide an implementation for :meth:`MultipleObjectMixin.get_paginator`.
+ provide an implementation for :meth:`get_paginator`.
.. attribute:: context_object_name
@@ -122,20 +120,20 @@ MultipleObjectMixin
Returns the number of items to paginate by, or ``None`` for no
pagination. By default this simply returns the value of
- :attr:`MultipleObjectMixin.paginate_by`.
+ :attr:`paginate_by`.
.. method:: get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True)
Returns an instance of the paginator to use for this view. By default,
instantiates an instance of :attr:`paginator_class`.
- .. method:: get_paginate_by()
+ .. method:: get_paginate_orphans()
.. versionadded:: 1.6
An integer specifying the number of "overflow" objects the last page
can contain. By default this simply returns the value of
- :attr:`MultipleObjectMixin.paginate_orphans`.
+ :attr:`paginate_orphans`.
.. method:: get_allow_empty()
@@ -149,7 +147,7 @@ MultipleObjectMixin
Return the context variable name that will be used to contain
the list of data that this view is manipulating. If
``object_list`` is a queryset of Django objects and
- :attr:`~MultipleObjectMixin.context_object_name` is not set,
+ :attr:`context_object_name` is not set,
the context name will be the ``object_name`` of the model that
the queryset is composed from, with postfix ``'_list'``
appended. For example, the model ``Article`` would have a
View
12 docs/ref/class-based-views/mixins-simple.txt
@@ -48,7 +48,7 @@ TemplateResponseMixin
.. attribute:: template_name
The full name of a template to use as defined by a string. Not defining
- a template_name will raise a
+ a ``template_name`` will raise a
:class:`django.core.exceptions.ImproperlyConfigured` exception.
.. attribute:: response_class
@@ -73,15 +73,13 @@ TemplateResponseMixin
If any keyword arguments are provided, they will be passed to the
constructor of the response class.
- Calls :meth:`~TemplateResponseMixin.get_template_names()` to obtain the
- list of template names that will be searched looking for an existent
- template.
+ Calls :meth:`get_template_names()` to obtain the list of template names
+ that will be searched looking for an existent template.
.. method:: get_template_names()
Returns a list of template names to search for when rendering the
template.
- If :attr:`TemplateResponseMixin.template_name` is specified, the
- default implementation will return a list containing
- :attr:`TemplateResponseMixin.template_name` (if it is specified).
+ If :attr:`template_name` is specified, the default implementation will
+ return a list containing :attr:`template_name` (if it is specified).
View
41 docs/ref/class-based-views/mixins-single-object.txt
@@ -21,8 +21,7 @@ SingleObjectMixin
.. attribute:: queryset
A ``QuerySet`` that represents the objects. If provided, the value of
- :attr:`SingleObjectMixin.queryset` supersedes the value provided for
- :attr:`SingleObjectMixin.model`.
+ ``queryset`` supersedes the value provided for :attr:`model`.
.. attribute:: slug_field
@@ -47,38 +46,38 @@ SingleObjectMixin
Returns the single object that this view will display. If
``queryset`` is provided, that queryset will be used as the
- source of objects; otherwise,
- :meth:`~SingleObjectMixin.get_queryset` will be used.
- ``get_object()`` looks for a
- :attr:`SingleObjectMixin.pk_url_kwarg` argument in the arguments
- to the view; if this argument is found, this method performs a
- primary-key based lookup using that value. If this argument is not
- found, it looks for a :attr:`SingleObjectMixin.slug_url_kwarg`
- argument, and performs a slug lookup using the
- :attr:`SingleObjectMixin.slug_field`.
+ source of objects; otherwise, :meth:`get_queryset` will be used.
+ ``get_object()`` looks for a :attr:`pk_url_kwarg` argument in the
+ arguments to the view; if this argument is found, this method performs
+ a primary-key based lookup using that value. If this argument is not
+ found, it looks for a :attr:`slug_url_kwarg` argument, and performs a
+ slug lookup using the :attr:`slug_field`.
.. method:: get_queryset()
Returns the queryset that will be used to retrieve the object that
- this view will display. By default,
- :meth:`~SingleObjectMixin.get_queryset` returns the value of the
- :attr:`~SingleObjectMixin.queryset` attribute if it is set, otherwise
- it constructs a :class:`QuerySet` by calling the `all()` method on the
- :attr:`~SingleObjectMixin.model` attribute's default manager.
+ this view will display. By default, :meth:`get_queryset` returns the
+ value of the :attr:`queryset` attribute if it is set, otherwise
+ it constructs a :class:`~django.db.models.query.QuerySet` by calling
+ the `all()` method on the :attr:`model` attribute's default manager.
.. method:: get_context_object_name(obj)
Return the context variable name that will be used to contain the
- data that this view is manipulating. If
- :attr:`~SingleObjectMixin.context_object_name` is not set, the context
- name will be constructed from the ``object_name`` of the model that
- the queryset is composed from. For example, the model ``Article``
- would have context object named ``'article'``.
+ data that this view is manipulating. If :attr:`context_object_name` is
+ not set, the context name will be constructed from the ``object_name``
+ of the model that the queryset is composed from. For example, the model
+ ``Article`` would have context object named ``'article'``.
.. method:: get_context_data(**kwargs)
Returns context data for displaying the list of objects.
+ .. method:: get_slug_field()
+
+ Returns the name of a slug field to be used to look up by slug. By
+ default this simply returns the value of :attr:`slug_field`.
+
**Context**
* ``object``: The object that this view is displaying. If
View
8 docs/ref/clickjacking.txt
@@ -111,10 +111,10 @@ Browsers that support X-Frame-Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Internet Explorer 8+
-* Firefox 3.6.9+
-* Opera 10.5+
-* Safari 4+
-* Chrome 4.1+
+* Firefox 3.6.9+
+* Opera 10.5+
+* Safari 4+
+* Chrome 4.1+
See also
~~~~~~~~
View
2  docs/ref/contrib/admin/admindocs.txt
@@ -24,7 +24,7 @@ the following:
* Add :mod:`django.contrib.admindocs` to your :setting:`INSTALLED_APPS`.
* Add ``(r'^admin/doc/', include('django.contrib.admindocs.urls'))`` to
- your :data:`urlpatterns`. Make sure it's included *before* the
+ your ``urlpatterns``. Make sure it's included *before* the
``r'^admin/'`` entry, so that requests to ``/admin/doc/`` don't get
handled by the latter entry.
* Install the docutils Python module (http://docutils.sf.net/).
View
26 docs/ref/contrib/admin/index.txt
@@ -170,7 +170,7 @@ subclass::
``fields`` option (for more complex layout needs see the
:attr:`~ModelAdmin.fieldsets` option described in the next section). For
example, you could define a simpler version of the admin form for the
- ``django.contrib.flatpages.FlatPage`` model as follows::
+ :class:`django.contrib.flatpages.models.FlatPage` model as follows::
class FlatPageAdmin(admin.ModelAdmin):
fields = ('url', 'title', 'content')
@@ -212,8 +212,8 @@ subclass::
a dictionary of information about the fieldset, including a list of fields
to be displayed in it.
- A full example, taken from the :class:`django.contrib.flatpages.FlatPage`
- model::
+ A full example, taken from the
+ :class:`django.contrib.flatpages.models.FlatPage` model::
class FlatPageAdmin(admin.ModelAdmin):
fieldsets = (
@@ -357,7 +357,7 @@ subclass::
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
- :meth:`~django.forms.Field.__init__`. See :doc:`/ref/forms/api` for
+ the form field's ``__init__()`` method. See :doc:`/ref/forms/api` for
details.
.. warning::
@@ -584,7 +584,7 @@ subclass::
class PersonAdmin(UserAdmin):
list_filter = ('company__name',)
- * a class inheriting from :mod:`django.contrib.admin.SimpleListFilter`,
+ * a class inheriting from ``django.contrib.admin.SimpleListFilter``,
which you need to provide the ``title`` and ``parameter_name``
attributes to and override the ``lookups`` and ``queryset`` methods,
e.g.::
@@ -671,7 +671,7 @@ subclass::
* a tuple, where the first element is a field name and the second
element is a class inheriting from
- :mod:`django.contrib.admin.FieldListFilter`, for example::
+ ``django.contrib.admin.FieldListFilter``, for example::
from django.contrib.admin import BooleanFieldListFilter
@@ -943,10 +943,9 @@ templates used by the :class:`ModelAdmin` views:
.. attribute:: ModelAdmin.delete_selected_confirmation_template
- Path to a custom template, used by the :meth:`delete_selected`
- action method for displaying a confirmation page when deleting one
- or more objects. See the :doc:`actions
- documentation</ref/contrib/admin/actions>`.
+ Path to a custom template, used by the ``delete_selected`` action method
+ for displaying a confirmation page when deleting one or more objects. See
+ the :doc:`actions documentation</ref/contrib/admin/actions>`.
.. attribute:: ModelAdmin.object_history_template
@@ -1108,9 +1107,8 @@ templates used by the :class:`ModelAdmin` views:
Since this is usually not what you want, Django provides a convenience
wrapper to check permissions and mark the view as non-cacheable. This
- wrapper is :meth:`AdminSite.admin_view` (i.e.
- ``self.admin_site.admin_view`` inside a ``ModelAdmin`` instance); use it
- like so::
+ wrapper is ``AdminSite.admin_view()`` (i.e. ``self.admin_site.admin_view``
+ inside a ``ModelAdmin`` instance); use it like so::
class MyModelAdmin(admin.ModelAdmin):
def get_urls(self):
@@ -1130,7 +1128,7 @@ templates used by the :class:`ModelAdmin` views:
If the page is cacheable, but you still want the permission check to be
performed, you can pass a ``cacheable=True`` argument to
- :meth:`AdminSite.admin_view`::
+ ``AdminSite.admin_view()``::
(r'^my_view/$', self.admin_site.admin_view(self.my_view, cacheable=True))
View
26 docs/ref/contrib/comments/custom.txt
@@ -66,15 +66,17 @@ In the ``models.py`` we'll define a ``CommentWithTitle`` model::
class CommentWithTitle(Comment):
title = models.CharField(max_length=300)
-Most custom comment models will subclass the :class:`Comment` model. However,
+Most custom comment models will subclass the
+:class:`~django.contrib.comments.models.Comment` model. However,
if you want to substantially remove or change the fields available in the
-:class:`Comment` model, but don't want to rewrite the templates, you could
-try subclassing from :class:`BaseCommentAbstractModel`.
+:class:`~django.contrib.comments.models.Comment` model, but don't want to
+rewrite the templates, you could try subclassing from
+``BaseCommentAbstractModel``.
Next, we'll define a custom comment form in ``forms.py``. This is a little more
tricky: we have to both create a form and override
-:meth:`CommentForm.get_comment_model` and
-:meth:`CommentForm.get_comment_create_data` to return deal with our custom title
+``CommentForm.get_comment_model()`` and
+``CommentForm.get_comment_create_data()`` to return deal with our custom title
field::
from django import forms
@@ -139,7 +141,7 @@ however.
Return the :class:`~django.db.models.Model` class to use for comments. This
model should inherit from
- :class:`django.contrib.comments.models.BaseCommentAbstractModel`, which
+ ``django.contrib.comments.models.BaseCommentAbstractModel``, which
defines necessary core fields.
The default implementation returns
@@ -170,33 +172,33 @@ however.
attribute when rendering your comment form.
The default implementation returns a reverse-resolved URL pointing
- to the :func:`post_comment` view.
+ to the ``post_comment()`` view.
.. note::
If you provide a custom comment model and/or form, but you
- want to use the default :func:`post_comment` view, you will
+ want to use the default ``post_comment()`` view, you will
need to be aware that it requires the model and form to have
certain additional attributes and methods: see the
- :func:`post_comment` view documentation for details.
+ ``django.contrib.comments.views.post_comment()`` view for details.
.. function:: get_flag_url()
Return the URL for the "flag this comment" view.
The default implementation returns a reverse-resolved URL pointing
- to the :func:`django.contrib.comments.views.moderation.flag` view.
+ to the ``django.contrib.comments.views.moderation.flag()`` view.
.. function:: get_delete_url()
Return the URL for the "delete this comment" view.
The default implementation returns a reverse-resolved URL pointing
- to the :func:`django.contrib.comments.views.moderation.delete` view.
+ to the ``django.contrib.comments.views.moderation.delete()`` view.
.. function:: get_approve_url()
Return the URL for the "approve this comment from moderation" view.
The default implementation returns a reverse-resolved URL pointing
- to the :func:`django.contrib.comments.views.moderation.approve` view.
+ to the ``django.contrib.comments.views.moderation.approve()`` view.
View
4 docs/ref/contrib/comments/example.txt
@@ -136,7 +136,7 @@ Feeds
=====
Suppose you want to export a :doc:`feed </ref/contrib/syndication>` of the
-latest comments, you can use the built-in :class:`LatestCommentFeed`. Just
+latest comments, you can use the built-in ``LatestCommentFeed``. Just
enable it in your project's ``urls.py``:
.. code-block:: python
@@ -166,7 +166,7 @@ features (all of which or only certain can be enabled):
* Close comments after a particular (user-defined) number of days.
* Email new comments to the site-staff.
-To enable comment moderation, we subclass the :class:`CommentModerator` and
+To enable comment moderation, we subclass the ``CommentModerator`` and
register it with the moderation features we want. Let's suppose we want to
close comments after 7 days of posting and also send out an email to the
site staff. In ``blog/models.py``, we register a comment moderator in the
View
9 docs/ref/contrib/comments/moderation.txt
@@ -185,15 +185,14 @@ via two methods:
be moderated using the options defined in the
``CommentModerator`` subclass. If any of the models are
already registered for moderation, the exception
- :exc:`AlreadyModerated` will be raised.
+ ``AlreadyModerated`` will be raised.
.. function:: moderator.unregister(model_or_iterable)
Takes one argument: a model class or list of model classes,
and removes the model or models from the set of models which
are being moderated. If any of the models are not currently
- being moderated, the exception
- :exc:`NotModerated` will be raised.
+ being moderated, the exception ``NotModerated`` will be raised.
Customizing the moderation system
@@ -207,8 +206,8 @@ models with an instance of the subclass.
.. class:: Moderator
- In addition to the :meth:`Moderator.register` and
- :meth:`Moderator.unregister` methods detailed above, the following methods
+ In addition to the :func:`moderator.register` and
+ :func:`moderator.unregister` methods detailed above, the following methods
on :class:`Moderator` can be overridden to achieve customized behavior:
.. method:: connect
View
4 docs/ref/contrib/comments/signals.txt
@@ -81,8 +81,8 @@ Arguments sent with this signal:
:meth:`~django.db.models.Model.save` again.
``flag``
- The :class:`~django.contrib.comments.models.CommentFlag` that's been
- attached to the comment.
+ The ``django.contrib.comments.models.CommentFlag`` that's been attached to
+ the comment.
``created``
``True`` if this is a new flag; ``False`` if it's a duplicate flag.
View
8 docs/ref/contrib/contenttypes.txt
@@ -453,7 +453,7 @@ Generic relations in forms and admin
------------------------------------
The :mod:`django.contrib.contenttypes.generic` module provides
-:class:`~django.contrib.contenttypes.generic.BaseGenericInlineFormSet`,
+``BaseGenericInlineFormSet``,
:class:`~django.contrib.contenttypes.generic.GenericTabularInline`
and :class:`~django.contrib.contenttypes.generic.GenericStackedInline`
(the last two are subclasses of
@@ -480,3 +480,9 @@ information.
The name of the integer field that represents the ID of the related
object. Defaults to ``object_id``.
+
+.. class:: GenericTabularInline
+.. class:: GenericStackedInline
+
+ Subclasses of :class:`GenericInlineModelAdmin` with stacked and tabular
+ layouts, respectively.
View
4 docs/ref/contrib/flatpages.txt
@@ -186,7 +186,7 @@ Via the Python API
If you add or modify flatpages via your own code, you will likely want to
check for duplicate flatpage URLs within the same site. The flatpage form
used in the admin performs this validation check, and can be imported from
- :class:`django.contrib.flatpages.forms.FlatPageForm` and used in your own
+ ``django.contrib.flatpages.forms.FlatPageForm`` and used in your own
views.
Flatpage templates
@@ -256,7 +256,7 @@ Displaying ``registration_required`` flatpages
By default, the :ttag:`get_flatpages` templatetag will only show
flatpages that are marked ``registration_required = False``. If you
want to display registration-protected flatpages, you need to specify
-an authenticated user using a``for`` clause.
+an authenticated user using a ``for`` clause.
For example:
View
16 docs/ref/contrib/formtools/form-preview.txt
@@ -25,9 +25,8 @@ application takes care of the following workflow:
a. If it's valid, displays a preview page.
b. If it's not valid, redisplays the form with error messages.
3. When the "confirmation" form is submitted from the preview page, calls
- a hook that you define -- a
- :meth:`~django.contrib.formtools.preview.FormPreview.done()` method that gets
- passed the valid data.
+ a hook that you define -- a ``done()`` method that gets passed the valid
+ data.
The framework enforces the required preview by passing a shared-secret hash to
the preview page via hidden form fields. If somebody tweaks the form parameters
@@ -51,8 +50,7 @@ How to use ``FormPreview``
directory to your :setting:`TEMPLATE_DIRS` setting.
2. Create a :class:`~django.contrib.formtools.preview.FormPreview` subclass that
- overrides the :meth:`~django.contrib.formtools.preview.FormPreview.done()`
- method::
+ overrides the ``done()`` method::
from django.contrib.formtools.preview import FormPreview
from myapp.models import SomeModel
@@ -92,13 +90,15 @@ How to use ``FormPreview``
A :class:`~django.contrib.formtools.preview.FormPreview` class is a simple Python class
that represents the preview workflow.
:class:`~django.contrib.formtools.preview.FormPreview` classes must subclass
-``django.contrib.formtools.preview.FormPreview`` and override the
-:meth:`~django.contrib.formtools.preview.FormPreview.done()` method. They can live
-anywhere in your codebase.
+``django.contrib.formtools.preview.FormPreview`` and override the ``done()``
+method. They can live anywhere in your codebase.
``FormPreview`` templates
=========================
+.. attribute:: FormPreview.form_template
+.. attribute:: FormPreview.preview_template
+
By default, the form is rendered via the template :file:`formtools/form.html`,
and the preview page is rendered via the template :file:`formtools/preview.html`.
These values can be overridden for a particular form preview by setting
View
32 docs/ref/contrib/formtools/form-wizard.txt
@@ -54,7 +54,8 @@ you just have to do these things:
4. Add ``django.contrib.formtools`` to your
:setting:`INSTALLED_APPS` list in your settings file.
-5. Point your URLconf at your :class:`WizardView` :meth:`~WizardView.as_view` method.
+5. Point your URLconf at your :class:`WizardView` :meth:`~WizardView.as_view`
+ method.
Defining ``Form`` classes
-------------------------
@@ -89,6 +90,9 @@ the message itself. Here's what the :file:`forms.py` might look like::
Creating a ``WizardView`` subclass
----------------------------------
+.. class:: SessionWizardView
+.. class:: CookieWizardView
+
The next step is to create a
:class:`django.contrib.formtools.wizard.views.WizardView` subclass. You can
also use the :class:`SessionWizardView` or :class:`CookieWizardView` classes
@@ -225,9 +229,11 @@ Here's a full example template:
Hooking the wizard into a URLconf
---------------------------------
+.. method:: WizardView.as_view
+
Finally, we need to specify which forms to use in the wizard, and then
deploy the new :class:`WizardView` object at a URL in the ``urls.py``. The
-wizard's :meth:`as_view` method takes a list of your
+wizard's ``as_view()`` method takes a list of your
:class:`~django.forms.Form` classes as an argument during instantiation::
from django.conf.urls import patterns
@@ -346,9 +352,9 @@ Advanced ``WizardView`` methods
used as the form for step ``step``.
Returns an :class:`~django.db.models.Model` object which will be passed as
- the :attr:`~django.forms.ModelForm.instance` argument when instantiating the
- ModelForm for step ``step``. If no instance object was provided while
- initializing the form wizard, ``None`` will be returned.
+ the ``instance`` argument when instantiating the ``ModelForm`` for step
+ ``step``. If no instance object was provided while initializing the form
+ wizard, ``None`` will be returned.
The default implementation::
@@ -514,10 +520,10 @@ Providing initial data for the forms
.. attribute:: WizardView.initial_dict
Initial data for a wizard's :class:`~django.forms.Form` objects can be
- provided using the optional :attr:`~Wizard.initial_dict` keyword argument.
- This argument should be a dictionary mapping the steps to dictionaries
- containing the initial data for each step. The dictionary of initial data
- will be passed along to the constructor of the step's
+ provided using the optional :attr:`~WizardView.initial_dict` keyword
+ argument. This argument should be a dictionary mapping the steps to
+ dictionaries containing the initial data for each step. The dictionary of
+ initial data will be passed along to the constructor of the step's
:class:`~django.forms.Form`::
>>> from myapp.forms import ContactForm1, ContactForm2
@@ -542,11 +548,13 @@ Providing initial data for the forms
Handling files
==============
+.. attribute:: WizardView.file_storage
+
To handle :class:`~django.forms.FileField` within any step form of the wizard,
-you have to add a :attr:`file_storage` to your :class:`WizardView` subclass.
+you have to add a ``file_storage`` to your :class:`WizardView` subclass.
This storage will temporarily store the uploaded files for the wizard. The
-:attr:`file_storage` attribute should be a
+``file_storage`` attribute should be a
:class:`~django.core.files.storage.Storage` subclass.
Django provides a built-in storage class (see :ref:`the built-in filesystem
@@ -646,6 +654,8 @@ Usage of ``NamedUrlWizardView``
===============================
.. class:: NamedUrlWizardView
+.. class:: NamedUrlSessionWizardView
+.. class:: NamedUrlCookieWizardView
There is a :class:`WizardView` subclass which adds named-urls support to the
wizard. By doing this, you can have single urls for every step. You can also
View
2  docs/ref/contrib/formtools/index.txt
@@ -1,6 +1,8 @@
django.contrib.formtools
========================
+.. module:: django.contrib.formtools
+
A set of high-level abstractions for Django forms (:mod:`django.forms`).
.. toctree::
View
17 docs/ref/contrib/gis/db-api.txt
@@ -4,20 +4,23 @@
GeoDjango Database API
======================
-.. module:: django.contrib.gis.db.models
- :synopsis: GeoDjango's database API.
-
.. _spatial-backends:
Spatial Backends
================
+.. module:: django.contrib.gis.db.backends
+ :synopsis: GeoDjango's spatial database backends.
+
GeoDjango currently provides the following spatial database backends:
-* :mod:`django.contrib.gis.db.backends.postgis`
-* :mod:`django.contrib.gis.db.backends.mysql`
-* :mod:`django.contrib.gis.db.backends.oracle`
-* :mod:`django.contrib.gis.db.backends.spatialite`
+* ``django.contrib.gis.db.backends.postgis``
+* ``django.contrib.gis.db.backends.mysql``
+* ``django.contrib.gis.db.backends.oracle``
+* ``django.contrib.gis.db.backends.spatialite``
+
+.. module:: django.contrib.gis.db.models
+ :synopsis: GeoDjango's database API.
.. _mysql-spatial-limitations:
View
10 docs/ref/contrib/gis/feeds.txt
@@ -27,7 +27,7 @@ API Reference
.. class:: Feed
In addition to methods provided by
- the :class:`django.contrib.syndication.feeds.Feed`
+ the :class:`django.contrib.syndication.views.Feed`
base class, GeoDjango's ``Feed`` class provides
the following overrides. Note that these overrides may be done in multiple ways::
@@ -71,11 +71,11 @@ API Reference
can be a ``GEOSGeometry`` instance, or a tuple that represents a
point coordinate or bounding box. For example::
- class ZipcodeFeed(Feed):
+ class ZipcodeFeed(Feed):
- def item_geometry(self, obj):
- # Returns the polygon.
- return obj.poly
+ def item_geometry(self, obj):
+ # Returns the polygon.
+ return obj.poly
``SyndicationFeed`` Subclasses
------------------------------
View
4 docs/ref/contrib/gis/geoquerysets.txt
@@ -683,7 +683,7 @@ Keyword Argument Description
a method name clashes with an existing
``GeoQuerySet`` method -- if you wanted to use the
``area()`` method on model with a ``PolygonField``
- named ``area``, for example.
+ named ``area``, for example.
===================== =====================================================
Measurement
@@ -1043,7 +1043,7 @@ Keyword Argument Description
===================== =====================================================
``relative`` If set to ``True``, the path data will be implemented
in terms of relative moves. Defaults to ``False``,
- meaning that absolute moves are used instead.
+ meaning that absolute moves are used instead.
``precision`` This keyword may be used to specify the number of
significant digits for the coordinates in the SVG
View
14 docs/ref/contrib/gis/geos.txt
@@ -142,10 +142,9 @@ Geometry Objects
.. class:: GEOSGeometry(geo_input[, srid=None])
- :param geo_input: Geometry input value
- :type geo_input: string or buffer
+ :param geo_input: Geometry input value (string or buffer)
:param srid: spatial reference identifier
- :type srid: integer
+ :type srid: int
This is the base class for all GEOS geometry objects. It initializes on the
given ``geo_input`` argument, and then assumes the proper geometry subclass
@@ -800,7 +799,7 @@ Example::
:param string: string that contains spatial data
:type string: string
:param srid: spatial reference identifier
- :type srid: integer
+ :type srid: int
:rtype: a :class:`GEOSGeometry` corresponding to the spatial data in the string
Example::
@@ -966,3 +965,10 @@ location (e.g., ``/home/bob/lib/libgeos_c.so``).
The setting must be the *full* path to the **C** shared library; in
other words you want to use ``libgeos_c.so``, not ``libgeos.so``.
+
+Exceptions
+==========
+
+.. exception:: GEOSException
+
+The base GEOS exception, indicates a GEOS-related error.
View
2  docs/ref/contrib/gis/install/index.txt
@@ -530,6 +530,6 @@ Finally, :ref:`install Django <installing-official-release>` on your system.
.. rubric:: Footnotes
.. [#] GeoDjango uses the :func:`~ctypes.util.find_library` routine from
- :mod:`ctypes.util` to locate shared libraries.
+ ``ctypes.util`` to locate shared libraries.
.. [#] The ``psycopg2`` Windows installers are packaged and maintained by
`Jason Erickson <http://www.stickpeople.com/projects/python/win-psycopg/>`_.
View
14 docs/ref/contrib/gis/tutorial.txt
@@ -226,7 +226,7 @@ model to represent this data::
class WorldBorder(models.Model):
# Regular Django fields corresponding to the attributes in the
- # world borders shapefile.
+ # world borders shapefile.
name = models.CharField(max_length=50)
area = models.IntegerField()
pop2005 = models.IntegerField('Population 2005')
@@ -236,13 +236,13 @@ model to represent this data::
un = models.IntegerField('United Nations Code')
region = models.IntegerField('Region Code')
subregion = models.IntegerField('Sub-Region Code')
- lon = models.FloatField()
- lat = models.FloatField()
+ lon = models.FloatField()
+ lat = models.FloatField()
- # GeoDjango-specific: a geometry field (MultiPolygonField), and
+ # GeoDjango-specific: a geometry field (MultiPolygonField), and
# overriding the default manager with a GeoManager instance.
- mpoly = models.MultiPolygonField()
- objects = models.GeoManager()
+ mpoly = models.MultiPolygonField()
+ objects = models.GeoManager()
# Returns the string representation of the model.
def __unicode__(self):
@@ -250,7 +250,7 @@ model to represent this data::
Please note two important things:
-1. The ``models`` module is imported from :mod:`django.contrib.gis.db`.
+1. The ``models`` module is imported from ``django.contrib.gis.db``.
2. You must override the model's default manager with
:class:`~django.contrib.gis.db.models.GeoManager` to perform spatial queries.
View
29 docs/ref/contrib/sitemaps.txt
@@ -49,6 +49,8 @@ loader can find the default templates.)
Initialization
==============
+.. function:: views.sitemap(request, sitemaps, section=None, template_name='sitemap.xml', mimetype='application/xml')
+
To activate sitemap generation on your Django site, add this line to your
:doc:`URLconf </topics/http/urls>`::
@@ -240,9 +242,9 @@ The sitemap framework provides a couple convenience classes for common cases:
The :class:`django.contrib.sitemaps.GenericSitemap` class allows you to
create a sitemap by passing it a dictionary which has to contain at least
- a :data:`queryset` entry. This queryset will be used to generate the items
- of the sitemap. It may also have a :data:`date_field` entry that
- specifies a date field for objects retrieved from the :data:`queryset`.
+ a ``queryset`` entry. This queryset will be used to generate the items
+ of the sitemap. It may also have a ``date_field`` entry that
+ specifies a date field for objects retrieved from the ``queryset``.
This will be used for the :attr:`~Sitemap.lastmod` attribute in the
generated sitemap. You may also pass :attr:`~Sitemap.priority` and
:attr:`~Sitemap.changefreq` keyword arguments to the
@@ -281,14 +283,16 @@ Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
Creating a sitemap index
========================
+.. function:: views.index(request, sitemaps, template_name='sitemap_index.xml', mimetype='application/xml', sitemap_url_name='django.contrib.sitemaps.views.sitemap')
+
The sitemap framework also has the ability to create a sitemap index that
references individual sitemap files, one per each section defined in your
-:data:`sitemaps` dictionary. The only differences in usage are:
+``sitemaps`` dictionary. The only differences in usage are:
* You use two views in your URLconf: :func:`django.contrib.sitemaps.views.index`
and :func:`django.contrib.sitemaps.views.sitemap`.
* The :func:`django.contrib.sitemaps.views.sitemap` view should take a
- :data:`section` keyword argument.
+ ``section`` keyword argument.
Here's what the relevant URLconf lines would look like for the example above::
@@ -299,7 +303,7 @@ Here's what the relevant URLconf lines would look like for the example above::
This will automatically generate a :file:`sitemap.xml` file that references
both :file:`sitemap-flatpages.xml` and :file:`sitemap-blog.xml`. The
-:class:`~django.contrib.sitemaps.Sitemap` classes and the :data:`sitemaps`
+:class:`~django.contrib.sitemaps.Sitemap` classes and the ``sitemaps``
dict don't change at all.
You should create an index file if one of your sitemaps has more than 50,000
@@ -350,19 +354,20 @@ rendering. For more details, see the :doc:`TemplateResponse documentation
Context variables
------------------
-When customizing the templates for the :func:`~django.contrib.sitemaps.views.index`
-and :func:`~django.contrib.sitemaps.views.sitemaps` views, you can rely on the
+When customizing the templates for the
+:func:`~django.contrib.sitemaps.views.index` and
+:func:`~django.contrib.sitemaps.views.sitemap` views, you can rely on the
following context variables.
Index
-----
-The variable :data:`sitemaps` is a list of absolute URLs to each of the sitemaps.
+The variable ``sitemaps`` is a list of absolute URLs to each of the sitemaps.
Sitemap
-------
-The variable :data:`urlset` is a list of URLs that should appear in the
+The variable ``urlset`` is a list of URLs that should appear in the
sitemap. Each URL exposes attributes as defined in the
:class:`~django.contrib.sitemaps.Sitemap` class:
@@ -411,14 +416,14 @@ that: :func:`django.contrib.sitemaps.ping_google()`.
.. function:: ping_google
- :func:`ping_google` takes an optional argument, :data:`sitemap_url`,
+ :func:`ping_google` takes an optional argument, ``sitemap_url``,
which should be the absolute path to your site's sitemap (e.g.,
:file:`'/sitemap.xml'`). If this argument isn't provided,
:func:`ping_google` will attempt to figure out your
sitemap by performing a reverse looking in your URLconf.
:func:`ping_google` raises the exception
- :exc:`django.contrib.sitemaps.SitemapNotFound` if it cannot determine your
+ ``django.contrib.sitemaps.SitemapNotFound`` if it cannot determine your
sitemap URL.
.. admonition:: Register with Google first!
View
10 docs/ref/contrib/staticfiles.txt
@@ -33,7 +33,7 @@ STATICFILES_DIRS
Default: ``[]``
This setting defines the additional locations the staticfiles app will traverse
-if the :class:`FileSystemFinder` finder is enabled, e.g. if you use the
+if the ``FileSystemFinder`` finder is enabled, e.g. if you use the
:djadmin:`collectstatic` or :djadmin:`findstatic` management command or use the
static file serving view.
@@ -101,19 +101,19 @@ The list of finder backends that know how to find static files in
various locations.
The default will find files stored in the :setting:`STATICFILES_DIRS` setting
-(using :class:`django.contrib.staticfiles.finders.FileSystemFinder`) and in a
+(using ``django.contrib.staticfiles.finders.FileSystemFinder``) and in a
``static`` subdirectory of each app (using
-:class:`django.contrib.staticfiles.finders.AppDirectoriesFinder`)
+``django.contrib.staticfiles.finders.AppDirectoriesFinder``)
One finder is disabled by default:
-:class:`django.contrib.staticfiles.finders.DefaultStorageFinder`. If added to
+``django.contrib.staticfiles.finders.DefaultStorageFinder``. If added to
your :setting:`STATICFILES_FINDERS` setting, it will look for static files in
the default file storage as defined by the :setting:`DEFAULT_FILE_STORAGE`
setting.
.. note::
- When using the :class:`AppDirectoriesFinder` finder, make sure your apps
+ When using the ``AppDirectoriesFinder`` finder, make sure your apps
can be found by staticfiles. Simply add the app to the
:setting:`INSTALLED_APPS` setting of your site.
View
2  docs/ref/contrib/syndication.txt
@@ -334,7 +334,7 @@ And the accompanying URLconf::
Feed class reference
--------------------
-.. class:: django.contrib.syndication.views.Feed
+.. class:: views.Feed
This example illustrates all possible attributes and methods for a
:class:`~django.contrib.syndication.views.Feed` class::
View
4 docs/ref/databases.txt
@@ -259,9 +259,9 @@ recommended solution.
Should you decide to use ``utf8_bin`` collation for some of your tables with
MySQLdb 1.2.1p2 or 1.2.2, you should still use ``utf8_collation_ci_swedish``
-(the default) collation for the :class:`django.contrib.sessions.models.Session`
+(the default) collation for the ``django.contrib.sessions.models.Session``
table (usually called ``django_session``) and the
-:class:`django.contrib.admin.models.LogEntry` table (usually called
+``django.contrib.admin.models.LogEntry`` table (usually called
``django_admin_log``). Those are the two standard tables that use
:class:`~django.db.models.TextField` internally.
View
2  docs/ref/django-admin.txt
@@ -292,6 +292,8 @@ Searches for and loads the contents of the named fixture into the database.
The :djadminopt:`--database` option can be used to specify the database
onto which the data will be loaded.
+.. django-admin-option:: --ignorenonexistent
+
.. versionadded:: 1.5
The :djadminopt:`--ignorenonexistent` option can be used to ignore fields that
View
15 docs/ref/exceptions.txt
@@ -131,6 +131,21 @@ The Django wrappers for database exceptions behave exactly the same as
the underlying database exceptions. See :pep:`249`, the Python Database API
Specification v2.0, for further information.
+.. exception:: models.ProtectedError
+
+Raised to prevent deletion of referenced objects when using
+:attr:`django.db.models.PROTECT`. Subclass of :exc:`IntegrityError`.
+
+.. currentmodule:: django.http
+
+Http Exceptions
+===============
+
+.. exception:: UnreadablePostError
+
+ The :exc:`UnreadablePostError` is raised when a user cancels an upload.
+ It is available from :mod:`django.http`.
+
.. currentmodule:: django.db.transaction
Transaction Exceptions
View
4 docs/ref/files/file.txt
@@ -14,7 +14,7 @@ The ``File`` Class
The :class:`File` is a thin wrapper around Python's built-in file object
with some Django-specific additions. Internally, Django uses this class
any time it needs to represent a file.
-
+
:class:`File` objects have the following attributes and methods:
.. attribute:: name
@@ -148,7 +148,7 @@ below) will also have a couple of extra methods:
Note that the ``content`` argument must be an instance of either
:class:`File` or of a subclass of :class:`File`, such as
- :class:`ContentFile`.
+ :class:`~django.core.files.base.ContentFile`.
.. method:: File.delete([save=True])
View
2  docs/ref/files/storage.txt
@@ -38,7 +38,7 @@ The FileSystemStorage Class
.. note::
- The :class:`FileSystemStorage.delete` method will not raise
+ The ``FileSystemStorage.delete()`` method will not raise
raise an exception if the given file name does not exist.
The Storage Class
View
41 docs/ref/forms/api.txt
@@ -2,9 +2,7 @@
The Forms API
=============
-.. module:: django.forms.forms
-
-.. currentmodule:: django.forms
+.. module:: django.forms
.. admonition:: About this document
@@ -380,6 +378,9 @@ a form object, and each rendering method returns a Unicode object.
Styling required or erroneous form rows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. attribute:: Form.error_css_class
+.. attribute:: Form.required_css_class
+
It's pretty common to style form rows and fields that are required or have
errors. For example, you might want to present required form rows in bold and
highlight errors in red.
@@ -587,24 +588,24 @@ lazy developers -- they're not the only way a form object can be displayed.
Used to display HTML or access attributes for a single field of a
:class:`Form` instance.
- The :meth:`__unicode__` and :meth:`__str__` methods of this object displays
+ The ``__unicode__()`` and ``__str__()`` methods of this object displays
the HTML for this field.
To retrieve a single ``BoundField``, use dictionary lookup syntax on your form
using the field's name as the key::
- >>> form = ContactForm()
- >>> print(form['subject'])
- <input id="id_subject" type="text" name="subject" maxlength="100" />
+ >>> form = ContactForm()
+ >>> print(form['subject'])
+ <input id="id_subject" type="text" name="subject" maxlength="100" />
To retrieve all ``BoundField`` objects, iterate the form::
- >>> form = ContactForm()
- >>> for boundfield in form: print(boundfield)
- <input id="id_subject" type="text" name="subject" maxlength="100" />
- <input type="text" name="message" id="id_message" />
- <input type="text" name="sender" id="id_sender" />
- <input type="checkbox" name="cc_myself" id="id_cc_myself" />
+ >>> form = ContactForm()
+ >>> for boundfield in form: print(boundfield)
+ <input id="id_subject" type="text" name="subject" maxlength="100" />
+ <input type="text" name="message" id="id_message" />
+ <input type="text" name="sender" id="id_sender" />
+ <input type="checkbox" name="cc_myself" id="id_cc_myself" />
The field-specific output honors the form object's ``auto_id`` setting::
@@ -635,7 +636,7 @@ For a field's list of errors, access the field's ``errors`` attribute.
>>> print(f['subject'].errors)
>>> str(f['subject'].errors)
- ''
+ ''
.. method:: BoundField.css_classes()
@@ -644,17 +645,17 @@ indicate required form fields or fields that contain errors. If you're
manually rendering a form, you can access these CSS classes using the
``css_classes`` method::
- >>> f = ContactForm(data)
- >>> f['message'].css_classes()
- 'required'
+ >>> f = ContactForm(data)
+ >>> f['message'].css_classes()
+ 'required'
If you want to provide some additional classes in addition to the
error and required classes that may be required, you can provide
those classes as an argument::
- >>> f = ContactForm(data)
- >>> f['message'].css_classes('foo bar')
- 'foo bar required'
+ >>> f = ContactForm(data)
+ >>> f['message'].css_classes('foo bar')
+ 'foo bar required'
.. method:: BoundField.value()
View
12 docs/ref/forms/widgets.txt
@@ -508,9 +508,9 @@ Selector and checkbox widgets
.. attribute:: Select.choices
- This attribute is optional when the field does not have a
- :attr:`~Field.choices` attribute. If it does, it will override anything
- you set here when the attribute is updated on the :class:`Field`.
+ This attribute is optional when the form field does not have a
+ ``choices`` attribute. If it does, it will override anything you set
+ here when the attribute is updated on the :class:`Field`.
``NullBooleanSelect``
~~~~~~~~~~~~~~~~~~~~~
@@ -660,9 +660,9 @@ Composite widgets
.. attribute:: MultipleHiddenInput.choices
- This attribute is optional when the field does not have a
- :attr:`~Field.choices` attribute. If it does, it will override anything
- you set here when the attribute is updated on the :class:`Field`.
+ This attribute is optional when the form field does not have a
+ ``choices`` attribute. If it does, it will override anything you set
+ here when the attribute is updated on the :class:`Field`.
``SplitDateTimeWidget``
~~~~~~~~~~~~~~~~~~~~~~~
View
4 docs/ref/middleware.txt
@@ -111,7 +111,7 @@ It will NOT compress content if any of the following are true:
not to be performed on certain content types.
You can apply GZip compression to individual views using the
-:func:`~django.views.decorators.http.gzip_page()` decorator.
+:func:`~django.views.decorators.gzip.gzip_page()` decorator.
Conditional GET middleware
--------------------------
@@ -124,7 +124,7 @@ Conditional GET middleware
Handles conditional GET operations. If the response has a ``ETag`` or
``Last-Modified`` header, and the request has ``If-None-Match`` or
``If-Modified-Since``, the response is replaced by an
-:class:`~django.http.HttpNotModified`.
+:class:`~django.http.HttpResponseNotModified`.
Also sets the ``Date`` and ``Content-Length`` response-headers.
View
93 docs/ref/models/fields.txt
@@ -113,7 +113,7 @@ define a suitably-named constant for each value::
default=FRESHMAN)
def is_upperclass(self):
- return self.year_in_school in (self.JUNIOR, self.SENIOR)
+ return self.year_in_school in (self.JUNIOR, self.SENIOR)
Though you can define a choices list outside of a model class and then
refer to it, defining the choices and names for each choice inside the
@@ -509,8 +509,8 @@ Has one **required** argument:
.. attribute:: FileField.upload_to