summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2012-07-26 18:58:10 +0100
committerAndrew Godwin <andrew@aeracode.org>2012-07-26 18:58:10 +0100
commit4a2e80fff44d0eb1856b593ac5f31ab1492b3e45 (patch)
tree9bc87a682dc488e6555792c1d4bb53f5f3cdc880 /docs/ref
parent959a3f9791d780062c4efe8765404a8ef95e87f0 (diff)
parentab6cd1c839b136cbc94178da433b2e97ab7f6061 (diff)
Merge branch 'master' of github.com:django/django into schema-alteration
Conflicts: django/db/backends/postgresql_psycopg2/base.py
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/class-based-views/generic-display.txt18
-rw-r--r--docs/ref/contrib/admin/index.txt35
-rw-r--r--docs/ref/contrib/comments/index.txt2
-rw-r--r--docs/ref/contrib/formtools/form-wizard.txt5
-rw-r--r--docs/ref/contrib/gis/deployment.txt59
-rw-r--r--docs/ref/contrib/gis/gdal.txt2
-rw-r--r--docs/ref/contrib/gis/geoquerysets.txt6
-rw-r--r--docs/ref/contrib/gis/geos.txt4
-rw-r--r--docs/ref/contrib/gis/install.txt91
-rw-r--r--docs/ref/contrib/gis/model-api.txt4
-rw-r--r--docs/ref/contrib/gis/sitemaps.txt9
-rw-r--r--docs/ref/contrib/gis/tutorial.txt2
-rw-r--r--docs/ref/contrib/localflavor.txt6
-rw-r--r--docs/ref/contrib/messages.txt7
-rw-r--r--docs/ref/contrib/sitemaps.txt2
-rw-r--r--docs/ref/contrib/staticfiles.txt11
-rw-r--r--docs/ref/databases.txt8
-rw-r--r--docs/ref/django-admin.txt26
-rw-r--r--docs/ref/forms/fields.txt6
-rw-r--r--docs/ref/forms/widgets.txt2
-rw-r--r--docs/ref/models/fields.txt22
-rw-r--r--docs/ref/models/instances.txt36
-rw-r--r--docs/ref/models/options.txt4
-rw-r--r--docs/ref/models/querysets.txt47
-rw-r--r--docs/ref/request-response.txt23
-rw-r--r--docs/ref/settings.txt2
-rw-r--r--docs/ref/templates/api.txt23
-rw-r--r--docs/ref/templates/builtins.txt23
-rw-r--r--docs/ref/utils.txt71
29 files changed, 294 insertions, 262 deletions
diff --git a/docs/ref/class-based-views/generic-display.txt b/docs/ref/class-based-views/generic-display.txt
index 8ec66a8cc1..bbf0d4f05a 100644
--- a/docs/ref/class-based-views/generic-display.txt
+++ b/docs/ref/class-based-views/generic-display.txt
@@ -54,7 +54,7 @@ many projects they are typically the most commonly used views.
from article.views import ArticleDetailView
urlpatterns = patterns('',
- url(r'^(?P<slug>[-_\w]+)/$', ArticleDetailView.as_view(), 'article-detail'),
+ url(r'^(?P<slug>[-_\w]+)/$', ArticleDetailView.as_view(), name='article-detail'),
)
.. class:: django.views.generic.list.ListView
@@ -76,11 +76,11 @@ many projects they are typically the most commonly used views.
**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:`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()`
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 3ef9abe6da..f28aa4687b 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -115,7 +115,7 @@ subclass::
.. attribute:: ModelAdmin.actions_selection_counter
- Controls whether a selection counter is display next to the action dropdown.
+ Controls whether a selection counter is displayed next to the action dropdown.
By default, the admin changelist will display it
(``actions_selection_counter = True``).
@@ -371,12 +371,6 @@ subclass::
because ``raw_id_fields`` and ``radio_fields`` imply custom widgets of
their own.
-.. attribute:: ModelAdmin.get_changelist
-
- Returns the Changelist class to be used for listing. By default,
- ``django.contrib.admin.views.main.ChangeList`` is used. By inheriting this
- class you can change the behavior of the listing.
-
.. attribute:: ModelAdmin.inlines
See :class:`InlineModelAdmin` objects below.
@@ -1168,6 +1162,12 @@ templates used by the :class:`ModelAdmin` views:
kwargs['choices'] += (('ready', 'Ready for deployment'),)
return super(MyModelAdmin, self).formfield_for_choice_field(db_field, request, **kwargs)
+.. method:: ModelAdmin.get_changelist(self, request, **kwargs)
+
+ Returns the Changelist class to be used for listing. By default,
+ ``django.contrib.admin.views.main.ChangeList`` is used. By inheriting this
+ class you can change the behavior of the listing.
+
.. method:: ModelAdmin.has_add_permission(self, request)
Should return ``True`` if adding an object is permitted, ``False``
@@ -1948,16 +1948,17 @@ accessible using Django's :ref:`URL reversing system <naming-url-patterns>`.
The :class:`AdminSite` provides the following named URL patterns:
-====================== ======================== =============
-Page URL name Parameters
-====================== ======================== =============
-Index ``index``
-Logout ``logout``
-Password change ``password_change``
-Password change done ``password_change_done``
-i18n javascript ``jsi18n``
-Application index page ``app_list`` ``app_label``
-====================== ======================== =============
+========================= ======================== ==================================
+Page URL name Parameters
+========================= ======================== ==================================
+Index ``index``
+Logout ``logout``
+Password change ``password_change``
+Password change done ``password_change_done``
+i18n javascript ``jsi18n``
+Application index page ``app_list`` ``app_label``
+Redirect to object's page ``view_on_site`` ``content_type_id``, ``object_id``
+========================= ======================== ==================================
Each :class:`ModelAdmin` instance provides an additional set of named URLs:
diff --git a/docs/ref/contrib/comments/index.txt b/docs/ref/contrib/comments/index.txt
index 40b1b662b7..af937e036e 100644
--- a/docs/ref/contrib/comments/index.txt
+++ b/docs/ref/contrib/comments/index.txt
@@ -250,7 +250,7 @@ Redirecting after the comment post
To specify the URL you want to redirect to after the comment has been posted,
you can include a hidden form input called ``next`` in your comment form. For example::
- <input type="hidden" name="next" value="{% url my_comment_was_posted %}" />
+ <input type="hidden" name="next" value="{% url 'my_comment_was_posted' %}" />
.. _notes-on-the-comment-form:
diff --git a/docs/ref/contrib/formtools/form-wizard.txt b/docs/ref/contrib/formtools/form-wizard.txt
index 7aafbe89f3..7d229a5d66 100644
--- a/docs/ref/contrib/formtools/form-wizard.txt
+++ b/docs/ref/contrib/formtools/form-wizard.txt
@@ -554,9 +554,8 @@ How to work with ModelForm and ModelFormSet
WizardView supports :doc:`ModelForms </topics/forms/modelforms>` and
:ref:`ModelFormSets <model-formsets>`. Additionally to
:attr:`~WizardView.initial_dict`, the :meth:`~WizardView.as_view` method takes
-an ``instance_dict`` argument that should contain instances of ``ModelForm`` and
-``ModelFormSet``. Similarly to :attr:`~WizardView.initial_dict`, these
-dictionary key values should be equal to the step number in the form list.
+an ``instance_dict`` argument that should contain model instances for steps
+based on ``ModelForm`` and querysets for steps based on ``ModelFormSet``.
Usage of ``NamedUrlWizardView``
===============================
diff --git a/docs/ref/contrib/gis/deployment.txt b/docs/ref/contrib/gis/deployment.txt
index d98fc51837..f90c9c2e91 100644
--- a/docs/ref/contrib/gis/deployment.txt
+++ b/docs/ref/contrib/gis/deployment.txt
@@ -2,6 +2,10 @@
Deploying GeoDjango
===================
+Basically, the deployment of a GeoDjango application is not different from
+the deployment of a normal Django application. Please consult Django's
+:doc:`deployment documentation </howto/deployment/index>`.
+
.. warning::
GeoDjango uses the GDAL geospatial library which is
@@ -10,58 +14,7 @@ Deploying GeoDjango
appropriate configuration of Apache or the prefork method
when using FastCGI through another Web server.
-Apache
-======
-In this section there are some example ``VirtualHost`` directives for
-when deploying using ``mod_wsgi``, which is now officially the recommended
-way to deploy Django applications with Apache.
-As long as ``mod_wsgi`` is configured correctly, it does not
-matter whether the version of Apache is prefork or worker.
-
-.. note::
-
- The ``Alias`` and ``Directory`` configurations in the examples
- below use an example path to a system-wide installation folder of Django.
- Substitute in an appropriate location, if necessary, as it may be
- different than the path on your system.
-
-``mod_wsgi``
-------------
-
-Example::
-
- <VirtualHost *:80>
- WSGIDaemonProcess geodjango user=geo group=geo processes=5 threads=1
- WSGIProcessGroup geodjango
- WSGIScriptAlias / /home/geo/geodjango/world.wsgi
-
- Alias /media/ "/usr/lib/python2.6/site-packages/django/contrib/admin/media/"
- <Directory "/usr/lib/python2.6/site-packages/django/contrib/admin/media/">
- Order allow,deny
- Options Indexes
- Allow from all
- IndexOptions FancyIndexing
- </Directory>
-
- </VirtualHost>
-
-.. warning::
-
- If the ``WSGIDaemonProcess`` attribute ``threads`` is not set to ``1``, then
+ For example, when configuring your application with ``mod_wsgi``,
+ set the ``WSGIDaemonProcess`` attribute ``threads`` to ``1``, unless
Apache may crash when running your GeoDjango application. Increase the
number of ``processes`` instead.
-
-For more information, please consult Django's
-:doc:`mod_wsgi documentation </howto/deployment/wsgi/modwsgi>`.
-
-Lighttpd
-========
-
-FastCGI
--------
-
-Nginx
-=====
-
-FastCGI
--------
diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt
index 619f23fba2..c4b29bead7 100644
--- a/docs/ref/contrib/gis/gdal.txt
+++ b/docs/ref/contrib/gis/gdal.txt
@@ -447,7 +447,7 @@ systems and coordinate transformation::
This object is a wrapper for the `OGR Geometry`__ class.
These objects are instantiated directly from the given ``geom_input``
- parameter, which may be a string containing WKT or HEX, a ``buffer``
+ parameter, which may be a string containing WKT, HEX, GeoJSON, a ``buffer``
containing WKB data, or an :class:`OGRGeomType` object. These objects
are also returned from the :class:`Feature.geom` attribute, when
reading vector data from :class:`Layer` (which is in turn a part of
diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt
index da00aa97f8..eeec2e2133 100644
--- a/docs/ref/contrib/gis/geoquerysets.txt
+++ b/docs/ref/contrib/gis/geoquerysets.txt
@@ -1026,7 +1026,7 @@ Keyword Argument Description
representation -- the default value is 8.
===================== =====================================================
-__ http://code.google.com/apis/kml/documentation/
+__ https://developers.google.com/kml/documentation/
``svg``
~~~~~~~
@@ -1185,7 +1185,7 @@ Keyword Argument Description
details.
===================== =====================================================
-__ http://download.oracle.com/docs/html/B14255_01/sdo_intro.htm#sthref150
+__ http://docs.oracle.com/html/B14255_01/sdo_intro.htm#sthref150
Aggregate Functions
-------------------
@@ -1232,6 +1232,6 @@ Returns the same as the :meth:`GeoQuerySet.union` aggregate method.
.. rubric:: Footnotes
.. [#fnde9im] *See* `OpenGIS Simple Feature Specification For SQL <http://www.opengis.org/docs/99-049.pdf>`_, at Ch. 2.1.13.2, p. 2-13 (The Dimensionally Extended Nine-Intersection Model).
-.. [#fnsdorelate] *See* `SDO_RELATE documentation <http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14255/sdo_operat.htm#sthref845>`_, from Ch. 11 of the Oracle Spatial User's Guide and Manual.
+.. [#fnsdorelate] *See* `SDO_RELATE documentation <http://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_operat.htm#sthref845>`_, from Ch. 11 of the Oracle Spatial User's Guide and Manual.
.. [#fncovers] For an explanation of this routine, read `Quirks of the "Contains" Spatial Predicate <http://lin-ear-th-inking.blogspot.com/2007/06/subtleties-of-ogc-covers-spatial.html>`_ by Martin Davis (a PostGIS developer).
.. [#fncontainsproperly] Refer to the PostGIS ``ST_ContainsProperly`` `documentation <http://postgis.refractions.net/documentation/manual-1.4/ST_ContainsProperly.html>`_ for more details.
diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt
index 1b32265e55..eda9617381 100644
--- a/docs/ref/contrib/gis/geos.txt
+++ b/docs/ref/contrib/gis/geos.txt
@@ -324,7 +324,7 @@ and Z values that are a part of this geometry.
Returns the Well-Known Text of the geometry (an OGC standard).
-__ http://code.google.com/apis/kml/documentation/
+__ https://developers.google.com/kml/documentation/
Spatial Predicate Methods
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -891,7 +891,7 @@ Returns the WKT of the given geometry. Example::
.. rubric:: Footnotes
-.. [#fnogc] *See* `PostGIS EWKB, EWKT and Canonical Forms <http://postgis.refractions.net/docs/ch04.html#id2591381>`_, PostGIS documentation at Ch. 4.1.2.
+.. [#fnogc] *See* `PostGIS EWKB, EWKT and Canonical Forms <http://postgis.refractions.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT>`_, PostGIS documentation at Ch. 4.1.2.
.. [#fncascadedunion] For more information, read Paul Ramsey's blog post about `(Much) Faster Unions in PostGIS 1.4 <http://blog.cleverelephant.ca/2009/01/must-faster-unions-in-postgis-14.html>`_ and Martin Davis' blog post on `Fast polygon merging in JTS using Cascaded Union <http://lin-ear-th-inking.blogspot.com/2007/11/fast-polygon-merging-in-jts-using.html>`_.
Settings
diff --git a/docs/ref/contrib/gis/install.txt b/docs/ref/contrib/gis/install.txt
index 4b7ee89a52..5ee6d5153d 100644
--- a/docs/ref/contrib/gis/install.txt
+++ b/docs/ref/contrib/gis/install.txt
@@ -81,7 +81,7 @@ Program Description Required
======================== ==================================== ================================ ==========================
:ref:`GEOS <ref-geos>` Geometry Engine Open Source Yes 3.3, 3.2, 3.1, 3.0
`PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 4.7, 4.6, 4.5, 4.4
-:ref:`GDAL <ref-gdal>` Geospatial Data Abstraction Library No (but, required for SQLite) 1.8, 1.7, 1.6, 1.5, 1.4
+:ref:`GDAL <ref-gdal>` Geospatial Data Abstraction Library No (but, required for SQLite) 1.9, 1.8, 1.7, 1.6, 1.5
:ref:`GeoIP <ref-geoip>` IP-based geolocation library No 1.4
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 1.5, 1.4, 1.3
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 3.0, 2.4, 2.3
@@ -102,7 +102,7 @@ Program Description Required
.. _PROJ.4: http://trac.osgeo.org/proj/
__ http://postgis.refractions.net/
-__ http://www.gaia-gis.it/spatialite/index.html
+__ http://www.gaia-gis.it/gaia-sins/
.. _build_from_source:
@@ -233,7 +233,7 @@ installed prior to building PostGIS.
The `psycopg2`_ module is required for use as the database adaptor
when using GeoDjango with PostGIS.
-.. _psycopg2: http://initd.org/projects/psycopg2
+.. _psycopg2: http://initd.org/psycopg/
First download the source archive, and extract::
@@ -270,9 +270,9 @@ supports :ref:`GDAL's vector data <ref-gdal>` capabilities [#]_.
First download the latest GDAL release version and untar the archive::
- $ wget http://download.osgeo.org/gdal/gdal-1.8.1.tar.gz
- $ tar xzf gdal-1.8.1.tar.gz
- $ cd gdal-1.8.1
+ $ wget http://download.osgeo.org/gdal/gdal-1.9.1.tar.gz
+ $ tar xzf gdal-1.9.1.tar.gz
+ $ cd gdal-1.9.1
Configure, make and install::
@@ -376,7 +376,7 @@ SpatiaLite.
After installation is complete, don't forget to read the post-installation
docs on :ref:`create_spatialite_db`.
-__ http://www.gaia-gis.it/spatialite/index.html
+__ http://www.gaia-gis.it/gaia-sins/
.. _sqlite:
@@ -457,7 +457,7 @@ Finally, do the same for the SpatiaLite tools::
$ ./configure --target=macosx
-__ http://www.gaia-gis.it/spatialite/sources.html
+__ http://www.gaia-gis.it/gaia-sins/libspatialite-sources/
.. _pysqlite2:
@@ -664,7 +664,7 @@ community! You can:
and specify the component as "GIS".
__ http://groups.google.com/group/geodjango
-__ https://code.djangoproject.com/simpleticket
+__ https://code.djangoproject.com/newticket
.. _libsettings:
@@ -762,13 +762,13 @@ Python
^^^^^^
Although OS X comes with Python installed, users can use framework
-installers (`2.5`__ and `2.6`__ are available) provided by
+installers (`2.6`__ and `2.7`__ are available) provided by
the Python Software Foundation. An advantage to using the installer is
that OS X's Python will remain "pristine" for internal operating system
use.
-__ http://python.org/ftp/python/2.5.4/python-2.5.4-macosx.dmg
-__ http://python.org/ftp/python/2.6.2/python-2.6.2-macosx2009-04-16.dmg
+__ http://python.org/ftp/python/2.6.6/python-2.6.6-macosx10.3.dmg
+__ http://python.org/ftp/python/2.7.3/
.. note::
@@ -838,17 +838,6 @@ your ``.profile`` to be able to run the package programs from the command-line::
__ http://www.kyngchaos.com/software/frameworks
__ http://www.kyngchaos.com/software/postgres
-.. note::
-
- Use of these binaries requires Django 1.0.3 and above. If you are
- using a previous version of Django (like 1.0.2), then you will have
- to add the following in your settings:
-
- .. code-block:: python
-
- GEOS_LIBRARY_PATH='/Library/Frameworks/GEOS.framework/GEOS'
- GDAL_LIBRARY_PATH='/Library/Frameworks/GDAL.framework/GDAL'
-
.. _psycopg2_kyngchaos:
psycopg2
@@ -903,7 +892,7 @@ add the following to your ``settings.py``:
SPATIALITE_LIBRARY_PATH='/Library/Frameworks/SQLite3.framework/SQLite3'
-__ http://www.gaia-gis.it/spatialite/binaries.html
+__ http://www.gaia-gis.it/spatialite-2.3.1/binaries.html
.. _fink:
@@ -1045,61 +1034,11 @@ Optional packages to consider:
do not plan on doing any database transformation of geometries to the
Google projection (900913).
-.. _heron:
-
-8.04 and lower
-~~~~~~~~~~~~~~
-
-The 8.04 (and lower) versions of Ubuntu use GEOS v2.2.3 in their binary packages,
-which is incompatible with GeoDjango. Thus, do *not* use the binary packages
-for GEOS or PostGIS and build some prerequisites from source, per the instructions
-in this document; however, it is okay to use the PostgreSQL binary packages.
-
-For more details, please see the Debian instructions for :ref:`etch` below.
-
.. _debian:
Debian
------
-.. _etch:
-
-4.0 (Etch)
-^^^^^^^^^^
-
-The situation here is the same as that of Ubuntu :ref:`heron` -- in other words,
-some packages must be built from source to work properly with GeoDjango.
-
-Binary packages
-~~~~~~~~~~~~~~~
-The following command will install acceptable binary packages, as well as
-the development tools necessary to build the rest of the requirements:
-
-.. code-block:: bash
-
- $ sudo apt-get install binutils bzip2 gcc g++ flex make postgresql-8.1 \
- postgresql-server-dev-8.1 python-ctypes python-psycopg2 python-setuptools
-
-Required package information:
-
-* ``binutils``: for ctypes to find libraries
-* ``bzip2``: for decompressing the source packages
-* ``gcc``, ``g++``, ``make``: GNU developer tools used to compile the libraries
-* ``flex``: required to build PostGIS
-* ``postgresql-8.1``
-* ``postgresql-server-dev-8.1``: for ``pg_config``
-* ``python-psycopg2``
-
-Optional packages:
-
-* ``libgeoip``: for :ref:`GeoIP <ref-geoip>` support
-
-Source packages
-~~~~~~~~~~~~~~~
-You will still have to install :ref:`geosbuild`, :ref:`proj4`,
-:ref:`postgis`, and :ref:`gdalbuild` from source. Please follow the
-directions carefully.
-
.. _lenny:
5.0 (Lenny)
@@ -1314,8 +1253,8 @@ may be executed from the SQL Shell as the ``postgres`` user::
.. rubric:: Footnotes
.. [#] The datum shifting files are needed for converting data to and from
certain projections.
- For example, the PROJ.4 string for the `Google projection (900913)
- <http://spatialreference.org/ref/epsg/900913/proj4>`_ requires the
+ For example, the PROJ.4 string for the `Google projection (900913 or 3857)
+ <http://spatialreference.org/ref/sr-org/6864/prj/>`_ requires the
``null`` grid file only included in the extra datum shifting files.
It is easier to install the shifting files now, then to have debug a
problem caused by their absence later.
diff --git a/docs/ref/contrib/gis/model-api.txt b/docs/ref/contrib/gis/model-api.txt
index 462df50d64..8c5274e6d3 100644
--- a/docs/ref/contrib/gis/model-api.txt
+++ b/docs/ref/contrib/gis/model-api.txt
@@ -142,7 +142,7 @@ __ http://en.wikipedia.org/wiki/Geodesy
__ http://en.wikipedia.org/wiki/Great_circle
__ http://www.spatialreference.org/ref/epsg/2796/
__ http://spatialreference.org/
-__ http://welcome.warnercnr.colostate.edu/class_info/nr502/lg3/datums_coordinates/spcs.html
+__ http://web.archive.org/web/20080302095452/http://welcome.warnercnr.colostate.edu/class_info/nr502/lg3/datums_coordinates/spcs.html
``spatial_index``
-----------------
@@ -252,7 +252,7 @@ for example::
qs = Address.objects.filter(zipcode__poly__contains='POINT(-104.590948 38.319914)')
.. rubric:: Footnotes
-.. [#fnogc] OpenGIS Consortium, Inc., `Simple Feature Specification For SQL <http://www.opengis.org/docs/99-049.pdf>`_, Document 99-049 (May 5, 1999).
+.. [#fnogc] OpenGIS Consortium, Inc., `Simple Feature Specification For SQL <http://www.opengeospatial.org/standards/sfs>`_.
.. [#fnogcsrid] *See id.* at Ch. 2.3.8, p. 39 (Geometry Values and Spatial Reference Systems).
.. [#fnsrid] Typically, SRID integer corresponds to an EPSG (`European Petroleum Survey Group <http://www.epsg.org>`_) identifier. However, it may also be associated with custom projections defined in spatial database's spatial reference systems table.
.. [#fnharvard] Harvard Graduate School of Design, `An Overview of Geodesy and Geographic Referencing Systems <http://www.gsd.harvard.edu/gis/manual/projections/fundamentals/>`_. This is an excellent resource for an overview of principles relating to geographic and Cartesian coordinate systems.
diff --git a/docs/ref/contrib/gis/sitemaps.txt b/docs/ref/contrib/gis/sitemaps.txt
index 75bddd3b86..0ab8f75825 100644
--- a/docs/ref/contrib/gis/sitemaps.txt
+++ b/docs/ref/contrib/gis/sitemaps.txt
@@ -2,10 +2,10 @@
Geographic Sitemaps
===================
-Google's sitemap protocol has been recently extended to support geospatial
-content. [#]_ This includes the addition of the ``<url>`` child element
+Google's sitemap protocol used to include geospatial content support. [#]_
+This included the addition of the ``<url>`` child element
``<geo:geo>``, which tells Google that the content located at the URL is
-geographic in nature. [#]_
+geographic in nature. This is now obsolete.
Example
=======
@@ -23,5 +23,4 @@ Reference
-----------------
.. rubric:: Footnotes
-.. [#] Google, Inc., `What is a Geo Sitemap? <http://www.google.com/support/webmasters/bin/answer.py?answer=94554>`_.
-.. [#] Google, Inc., `Submit Your Geo Content to Google <http://code.google.com/apis/kml/documentation/kmlSearch.html>`_.
+.. [#] Google, Inc., `What is a Geo Sitemap? <http://support.google.com/webmasters/bin/answer.py?answer=94555>`_.
diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt
index 395eac1821..3a63493137 100644
--- a/docs/ref/contrib/gis/tutorial.txt
+++ b/docs/ref/contrib/gis/tutorial.txt
@@ -784,4 +784,4 @@ option class in your ``admin.py`` file::
.. [#] Special thanks to Bjørn Sandvik of `thematicmapping.org <http://thematicmapping.org>`_ for providing and maintaining this data set.
.. [#] GeoDjango basic apps was written by Dane Springmeyer, Josh Livni, and Christopher Schmidt.
.. [#] Here the point is for the `University of Houston Law Center <http://www.law.uh.edu/>`_.
-.. [#] Open Geospatial Consortium, Inc., `OpenGIS Simple Feature Specification For SQL <http://www.opengis.org/docs/99-049.pdf>`_, Document 99-049.
+.. [#] Open Geospatial Consortium, Inc., `OpenGIS Simple Feature Specification For SQL <http://www.opengeospatial.org/standards/sfs>`_.
diff --git a/docs/ref/contrib/localflavor.txt b/docs/ref/contrib/localflavor.txt
index 61c8c7ae47..4595f51d9e 100644
--- a/docs/ref/contrib/localflavor.txt
+++ b/docs/ref/contrib/localflavor.txt
@@ -93,7 +93,7 @@ Here's an example of how to use them::
class MyForm(forms.Form):
my_date_field = generic.forms.DateField()
-.. _ISO 3166 country codes: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
+.. _ISO 3166 country codes: http://www.iso.org/iso/country_codes.htm
.. _Argentina: `Argentina (ar)`_
.. _Australia: `Australia (au)`_
.. _Austria: `Austria (at)`_
@@ -158,7 +158,7 @@ any code you'd like to contribute. One thing we ask is that you please use
Unicode objects (``u'mystring'``) for strings, rather than setting the encoding
in the file. See any of the existing flavors for examples.
-.. _create a ticket: https://code.djangoproject.com/simpleticket
+.. _create a ticket: https://code.djangoproject.com/newticket
Localflavor and backwards compatibility
=======================================
@@ -713,7 +713,7 @@ Italy (``it``)
A form field that validates input as an Italian social security number
(`codice fiscale`_).
-.. _codice fiscale: http://www.agenziaentrate.it/ilwwcm/connect/Nsi/Servizi/Codice+fiscale+-+tessera+sanitaria/NSI+Informazioni+sulla+codificazione+delle+persone+fisiche
+.. _codice fiscale: http://www.agenziaentrate.gov.it/wps/content/Nsilib/Nsi/Home/CosaDeviFare/Richiedere/Codice+fiscale+e+tessera+sanitaria/Richiesta+TS_CF/SchedaI/Informazioni+codificazione+pf/
.. class:: it.forms.ITVatNumberField
diff --git a/docs/ref/contrib/messages.txt b/docs/ref/contrib/messages.txt
index da6336e832..6929a3b0d0 100644
--- a/docs/ref/contrib/messages.txt
+++ b/docs/ref/contrib/messages.txt
@@ -54,7 +54,8 @@ Storage backends
----------------
The messages framework can use different backends to store temporary messages.
-To change which backend is being used, add a `MESSAGE_STORAGE`_ to your
+If the default FallbackStorage isn't suitable to your needs, you can change
+which backend is being used by adding a `MESSAGE_STORAGE`_ to your
settings, referencing the module and class of the storage class. For
example::
@@ -62,7 +63,7 @@ example::
The value should be the full path of the desired storage class.
-Four storage classes are included:
+Three storage classes are available:
``'django.contrib.messages.storage.session.SessionStorage'``
This class stores all messages inside of the request's session. It
@@ -74,6 +75,8 @@ Four storage classes are included:
messages are dropped if the cookie data size would exceed 4096 bytes.
``'django.contrib.messages.storage.fallback.FallbackStorage'``
+ This is the default storage class.
+
This class first uses CookieStorage for all messages, falling back to using
SessionStorage for the messages that could not fit in a single cookie.
diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt
index d775092eae..2393a4a9a3 100644
--- a/docs/ref/contrib/sitemaps.txt
+++ b/docs/ref/contrib/sitemaps.txt
@@ -410,7 +410,7 @@ generate a Google News compatible sitemap:
{% endspaceless %}
</urlset>
-.. _`Google news sitemaps`: http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=74288
+.. _`Google news sitemaps`: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=74288
Pinging Google
==============
diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt
index 126bcdd4e6..cbe8ad54b8 100644
--- a/docs/ref/contrib/staticfiles.txt
+++ b/docs/ref/contrib/staticfiles.txt
@@ -387,6 +387,17 @@ The previous example is equal to calling the ``url`` method of an instance of
useful when using a non-local storage backend to deploy files as documented
in :ref:`staticfiles-from-cdn`.
+.. versionadded:: 1.5
+
+If you'd like to retrieve a static URL without displaying it, you can use a
+slightly different call:
+
+.. code-block:: html+django
+
+ {% load static from staticfiles %}
+ {% static "images/hi.jpg" as myphoto %}
+ <img src="{{ myphoto }}" alt="Hi!" />
+
Other Helpers
=============
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index 600de8ed3a..74e6b48f07 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -31,7 +31,7 @@ attempt to use the ``StdDev(sample=False)`` or ``Variance(sample=False)``
aggregate with a database backend that falls within the affected release range.
.. _known to be faulty: http://archives.postgresql.org/pgsql-bugs/2007-07/msg00046.php
-.. _Release 8.2.5: http://developer.postgresql.org/pgdocs/postgres/release-8-2-5.html
+.. _Release 8.2.5: http://www.postgresql.org/docs/devel/static/release-8-2-5.html
Optimizing PostgreSQL's configuration
-------------------------------------
@@ -111,7 +111,7 @@ outputs a single ``CREATE INDEX`` statement. However, if the database type
for the field is either ``varchar`` or ``text`` (e.g., used by ``CharField``,
``FileField``, and ``TextField``), then Django will create
an additional index that uses an appropriate `PostgreSQL operator class`_
-for the column. The extra index is necessary to correctly perfrom
+for the column. The extra index is necessary to correctly perform
lookups that use the ``LIKE`` operator in their SQL, as is done with the
``contains`` and ``startswith`` lookup types.
@@ -335,7 +335,9 @@ storage engine, you have a couple of options.
}
This sets the default storage engine upon connecting to the database.
- After your tables have been created, you should remove this option.
+ After your tables have been created, you should remove this option as it
+ adds a query that is only needed during table creation to each database
+ connection.
* Another method for changing the storage engine is described in
AlterModelOnSyncDB_.
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 360c0ae4d3..c4295c68d5 100644
--- a/docs/ref/django-admin.txt
+++ b/docs/ref/django-admin.txt
@@ -224,8 +224,8 @@ flush
.. django-admin:: flush
-Returns the database to the state it was in immediately after syncdb was
-executed. This means that all data will be removed from the database, any
+Returns the database to the state it was in immediately after :djadmin:`syncdb`
+was executed. This means that all data will be removed from the database, any
post-synchronization handlers will be re-executed, and the ``initial_data``
fixture will be re-installed.
@@ -668,6 +668,7 @@ Example usage::
.. versionadded:: 1.4
+Since version 1.4, the development server is multithreaded by default.
Use the ``--nothreading`` option to disable the use of threading in the
development server.
@@ -742,6 +743,24 @@ use the ``--plain`` option, like so::
django-admin.py shell --plain
+.. versionchanged:: 1.5
+
+If you would like to specify either IPython or bpython as your interpreter if
+you have both installed you can specify an alternative interpreter interface
+with the ``-i`` or ``--interface`` options like so::
+
+IPython::
+
+ django-admin.py shell -i ipython
+ django-admin.py shell --interface ipython
+
+
+bpython::
+
+ django-admin.py shell -i bpython
+ django-admin.py shell --interface bpython
+
+
.. _IPython: http://ipython.scipy.org/
.. _bpython: http://bpython-interpreter.org/
@@ -887,7 +906,8 @@ through the template engine: the files whose extensions match the
with the ``--name`` option. The :class:`template context
<django.template.Context>` used is:
-- Any option passed to the startapp command
+- Any option passed to the startapp command (among the command's supported
+ options)
- ``app_name`` -- the app name as passed to the command
- ``app_directory`` -- the full path of the newly created app
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index 486d49d796..082ec17a35 100644
--- a/docs/ref/forms/fields.txt
+++ b/docs/ref/forms/fields.txt
@@ -591,7 +591,11 @@ For each field, we describe the default widget used if you don't specify
* Error message keys: ``required``, ``invalid``, ``missing``, ``empty``,
``invalid_image``
- Using an ImageField requires that the `Python Imaging Library`_ is installed.
+ Using an ``ImageField`` requires that the `Python Imaging Library`_ (PIL)
+ is installed and supports the image formats you use. If you encounter a
+ ``corrupt image`` error when you upload an image, it usually means PIL
+ doesn't understand its format. To fix this, install the appropriate
+ library and reinstall PIL.
When you use an ``ImageField`` on a form, you must also remember to
:ref:`bind the file data to the form <binding-uploaded-files>`.
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index 88d0d706cd..fb7657349a 100644
--- a/docs/ref/forms/widgets.txt
+++ b/docs/ref/forms/widgets.txt
@@ -75,7 +75,7 @@ changing :attr:`ChoiceField.choices` will update :attr:`Select.choices`. For
example::
>>> from django import forms
- >>> CHOICES = (('1', 'First',), ('2', 'Second',)))
+ >>> CHOICES = (('1', 'First',), ('2', 'Second',))
>>> choice_field = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES)
>>> choice_field.choices
[('1', 'First'), ('2', 'Second')]
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 23dcf4bd9f..5039ba4373 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -1074,15 +1074,14 @@ the model is related. This works exactly the same as it does for
Database Representation
~~~~~~~~~~~~~~~~~~~~~~~
-Behind the scenes, Django creates an intermediary join table to
-represent the many-to-many relationship. By default, this table name
-is generated using the name of the many-to-many field and the model
-that contains it. Since some databases don't support table names above
-a certain length, these table names will be automatically truncated to
-64 characters and a uniqueness hash will be used. This means you might
-see table names like ``author_books_9cdf4``; this is perfectly normal.
-You can manually provide the name of the join table using the
-:attr:`~ManyToManyField.db_table` option.
+Behind the scenes, Django creates an intermediary join table to represent the
+many-to-many relationship. By default, this table name is generated using the
+name of the many-to-many field and the name of the table for the model that
+contains it. Since some databases don't support table names above a certain
+length, these table names will be automatically truncated to 64 characters and a
+uniqueness hash will be used. This means you might see table names like
+``author_books_9cdf4``; this is perfectly normal. You can manually provide the
+name of the join table using the :attr:`~ManyToManyField.db_table` option.
.. _manytomany-arguments:
@@ -1138,8 +1137,9 @@ that control how the relationship functions.
.. attribute:: ManyToManyField.db_table
The name of the table to create for storing the many-to-many data. If this
- is not provided, Django will assume a default name based upon the names of
- the two tables being joined.
+ is not provided, Django will assume a default name based upon the names of:
+ the table for the model defining the relationship and the name of the field
+ itself.
.. _ref-onetoone:
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index 3ae994bc5b..509ea9d30e 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -25,6 +25,41 @@ The keyword arguments are simply the names of the fields you've defined on your
model. Note that instantiating a model in no way touches your database; for
that, you need to :meth:`~Model.save()`.
+.. note::
+
+ You may be tempted to customize the model by overriding the ``__init__``
+ method. If you do so, however, take care not to change the calling
+ signature as any change may prevent the model instance from being saved.
+ Rather than overriding ``__init__``, try using one of these approaches:
+
+ 1. Add a classmethod on the model class::
+
+ class Book(models.Model):
+ title = models.CharField(max_length=100)
+
+ @classmethod
+ def create(cls, title):
+ book = cls(title=title)
+ # do something with the book
+ return book
+
+ book = Book.create("Pride and Prejudice")
+
+ 2. Add a method on a custom manager (usually preferred)::
+
+ class BookManager(models.Manager):
+ def create_book(title):
+ book = self.create(title=title)
+ # do something with the book
+ return book
+
+ class Book(models.Model):
+ title = models.CharField(max_length=100)
+
+ objects = BookManager()
+
+ book = Book.objects.create_book("Pride and Prejudice")
+
.. _validating-objects:
Validating objects
@@ -604,4 +639,3 @@ described in :ref:`Field lookups <field-lookups>`.
Note that in the case of identical date values, these methods will use the
primary key as a tie-breaker. This guarantees that no records are skipped or
duplicated. That also means you cannot use those methods on unsaved objects.
-
diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt
index 6ca3d3b2d0..9d076f6274 100644
--- a/docs/ref/models/options.txt
+++ b/docs/ref/models/options.txt
@@ -244,12 +244,12 @@ Django quotes column and table names behind the scenes.
unique_together = (("driver", "restaurant"),)
- This is a list of lists of fields that must be unique when considered together.
+ This is a tuple of tuples that must be unique when considered together.
It's used in the Django admin and is enforced at the database level (i.e., the
appropriate ``UNIQUE`` statements are included in the ``CREATE TABLE``
statement).
- For convenience, unique_together can be a single list when dealing with a single
+ For convenience, unique_together can be a single tuple when dealing with a single
set of fields::
unique_together = ("driver", "restaurant")
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index eef22728ab..8c188c67c3 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -1081,11 +1081,13 @@ to ``defer()``::
# Load all fields immediately.
my_queryset.defer(None)
+.. versionchanged:: 1.5
+
Some fields in a model won't be deferred, even if you ask for them. You can
never defer the loading of the primary key. If you are using
:meth:`select_related()` to retrieve related models, you shouldn't defer the
-loading of the field that connects from the primary model to the related one
-(at the moment, that doesn't raise an error, but it will eventually).
+loading of the field that connects from the primary model to the related
+one, doing so will result in an error.
.. note::
@@ -1145,9 +1147,12 @@ logically::
# existing set of fields).
Entry.objects.defer("body").only("headline", "body")
+.. versionchanged:: 1.5
+
All of the cautions in the note for the :meth:`defer` documentation apply to
``only()`` as well. Use it cautiously and only after exhausting your other
-options.
+options. Also note that using :meth:`only` and omitting a field requested
+using :meth:`select_related` is an error as well.
using
~~~~~
@@ -1345,7 +1350,7 @@ has a side effect on your data. For more, see `Safe methods`_ in the HTTP spec.
bulk_create
~~~~~~~~~~~
-.. method:: bulk_create(objs)
+.. method:: bulk_create(objs, batch_size=None)
.. versionadded:: 1.4
@@ -1367,20 +1372,12 @@ This has a number of caveats though:
* If the model's primary key is an :class:`~django.db.models.AutoField` it
does not retrieve and set the primary key attribute, as ``save()`` does.
-.. admonition:: Limits of SQLite
-
- SQLite sets a limit on the number of parameters per SQL statement. The
- maximum is defined by the SQLITE_MAX_VARIABLE_NUMBER_ compilation option,
- which defaults to 999. For instance, if your model has 8 fields (including
- the primary key), you cannot create more than 999 // 8 = 124 instances at
- a time. If you exceed this limit, you'll get an exception::
+The ``batch_size`` parameter controls how many objects are created in single
+query. The default is to create all objects in one batch, except for SQLite
+where the default is such that at maximum 999 variables per query is used.
- django.db.utils.DatabaseError: too many SQL variables
-
- If your application's performance requirements exceed SQLite's limits, you
- should switch to another database engine, such as PostgreSQL.
-
-.. _SQLITE_MAX_VARIABLE_NUMBER: http://sqlite.org/limits.html#max_variable_number
+.. versionadded:: 1.5
+ The ``batch_size`` parameter was added in version 1.5.
count
~~~~~
@@ -1763,22 +1760,6 @@ This queryset will be evaluated as subselect statement::
SELECT ... WHERE blog.id IN (SELECT id FROM ... WHERE NAME LIKE '%Cheddar%')
-The above code fragment could also be written as follows::
-
- inner_q = Blog.objects.filter(name__contains='Cheddar').values('pk').query
- entries = Entry.objects.filter(blog__in=inner_q)
-
-.. warning::
-
- This ``query`` attribute should be considered an opaque internal attribute.
- It's fine to use it like above, but its API may change between Django
- versions.
-
-This second form is a bit less readable and unnatural to write, since it
-accesses the internal ``query`` attribute and requires a ``ValuesQuerySet``.
-If your code doesn't require compatibility with Django 1.0, use the first
-form, passing in a queryset directly.
-
If you pass in a ``ValuesQuerySet`` or ``ValuesListQuerySet`` (the result of
calling ``values()`` or ``values_list()`` on a queryset) as the value to an
``__in`` lookup, you need to ensure you are only extracting one field in the
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index d2b6f35b84..551ee00c6b 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -606,11 +606,10 @@ Attributes
Methods
-------
-.. method:: HttpResponse.__init__(content='', mimetype=None, status=200, content_type=DEFAULT_CONTENT_TYPE)
+.. method:: HttpResponse.__init__(content='', content_type=None, status=200)
- Instantiates an ``HttpResponse`` object with the given page content (a
- string) and MIME type. The :setting:`DEFAULT_CONTENT_TYPE` is
- ``'text/html'``.
+ Instantiates an ``HttpResponse`` object with the given page content and
+ content type.
``content`` should be an iterator or a string. If it's an
iterator, it should return strings, and those strings will be
@@ -618,15 +617,15 @@ Methods
an iterator or a string, it will be converted to a string when
accessed.
+ ``content_type`` is the MIME type optionally completed by a character set
+ encoding and is used to fill the HTTP ``Content-Type`` header. If not
+ specified, it is formed by the :setting:`DEFAULT_CONTENT_TYPE` and
+ :setting:`DEFAULT_CHARSET` settings, by default: "`text/html; charset=utf-8`".
+
+ Historically, this parameter was called ``mimetype`` (now deprecated).
+
``status`` is the `HTTP Status code`_ for the response.
- ``content_type`` is an alias for ``mimetype``. Historically, this parameter
- was only called ``mimetype``, but since this is actually the value included
- in the HTTP ``Content-Type`` header, it can also include the character set
- encoding, which makes it more than just a MIME type specification.
- If ``mimetype`` is specified (not ``None``), that value is used.
- Otherwise, ``content_type`` is used. If neither is given, the
- :setting:`DEFAULT_CONTENT_TYPE` setting is used.
.. method:: HttpResponse.__setitem__(header, value)
@@ -684,7 +683,7 @@ Methods
risk of client side script accessing the protected cookie
data.
- .. _HTTPOnly: http://www.owasp.org/index.php/HTTPOnly
+ .. _HTTPOnly: https://www.owasp.org/index.php/HTTPOnly
.. method:: HttpResponse.set_signed_cookie(key, value='', salt='', max_age=None, expires=None, path='/', domain=None, secure=None, httponly=True)
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index 627aa5007f..72d60453c3 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -1675,7 +1675,7 @@ consistently by all browsers. However, when it is honored, it can be a
useful way to mitigate the risk of client side script accessing the
protected cookie data.
-.. _HTTPOnly: http://www.owasp.org/index.php/HTTPOnly
+.. _HTTPOnly: https://www.owasp.org/index.php/HTTPOnly
.. versionchanged:: 1.4
The default value of the setting was changed from ``False`` to ``True``.
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 6142dd7017..bd2b4c6e9d 100644
--- a/docs/ref/templates/api.txt
+++ b/docs/ref/templates/api.txt
@@ -370,6 +370,7 @@ and return a dictionary of items to be merged into the context. By default,
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
+ "django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages")
In addition to these, ``RequestContext`` always uses
@@ -648,14 +649,24 @@ class. Here are the template loaders that come with Django:
INSTALLED_APPS = ('myproject.polls', 'myproject.music')
- ...then ``get_template('foo.html')`` will look for templates in these
+ ...then ``get_template('foo.html')`` will look for ``foo.html`` in these
directories, in this order:
- * ``/path/to/myproject/polls/templates/foo.html``
- * ``/path/to/myproject/music/templates/foo.html``
+ * ``/path/to/myproject/polls/templates/``
+ * ``/path/to/myproject/music/templates/``
- Note that the loader performs an optimization when it is first imported: It
- caches a list of which :setting:`INSTALLED_APPS` packages have a
+ ... and will use the one it finds first.
+
+ The order of :setting:`INSTALLED_APPS` is significant! For example, if you
+ want to customize the Django admin, you might choose to override the
+ standard ``admin/base_site.html`` template, from ``django.contrib.admin``,
+ with your own ``admin/base_site.html`` in ``myproject.polls``. You must
+ then make sure that your ``myproject.polls`` comes *before*
+ ``django.contrib.admin`` in :setting:`INSTALLED_APPS`, otherwise
+ ``django.contrib.admin``'s will be loaded first and yours will be ignored.
+
+ Note that the loader performs an optimization when it is first imported:
+ it caches a list of which :setting:`INSTALLED_APPS` packages have a
``templates`` subdirectory.
This loader is enabled by default.
@@ -773,7 +784,7 @@ Using an alternative template language
The Django ``Template`` and ``Loader`` classes implement a simple API for
loading and rendering templates. By providing some simple wrapper classes that
implement this API we can use third party template systems like `Jinja2
-<http://jinja.pocoo.org/2/>`_ or `Cheetah <http://www.cheetahtemplate.org/>`_. This
+<http://jinja.pocoo.org/docs/>`_ or `Cheetah <http://www.cheetahtemplate.org/>`_. This
allows us to use third-party template libraries without giving up useful Django
features like the Django ``Context`` object and handy shortcuts like
:func:`~django.shortcuts.render_to_response()`.
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index 6f341e9f97..500a47c6f1 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -419,7 +419,7 @@ will be interpreted like:
if (athlete_list and coach_list) or cheerleader_list
-Use of actual brackets in the :ttag:`if` tag is invalid syntax. If you need
+Use of actual parentheses in the :ttag:`if` tag is invalid syntax. If you need
them to indicate precedence, you should use nested :ttag:`if` tags.
:ttag:`if` tags may also use the operators ``==``, ``!=``, ``<``, ``>``,
@@ -1047,12 +1047,12 @@ Django's syntax. For example::
{{if dying}}Still alive.{{/if}}
{% endverbatim %}
-You can also specify an alternate closing tag::
+You can also designate a specific closing tag, allowing the use of
+``{% endverbatim %}`` as part of the unrendered contents::
- {% verbatim finished %}
- The verbatim tag looks like this:
- {% verbatim %}{% endverbatim %}
- {% finished %}
+ {% verbatim myblock %}
+ Avoid template rendering via the {% verbatim %}{% endverbatim %} block.
+ {% endverbatim myblock %}
.. templatetag:: widthratio
@@ -2354,6 +2354,17 @@ It is also able to consume standard context variables, e.g. assuming a
{% load static %}
<link rel="stylesheet" href="{% static user_stylesheet %}" type="text/css" media="screen" />
+If you'd like to retrieve a static URL without displaying it, you can use a
+slightly different call::
+
+.. versionadded:: 1.5
+
+.. code-block:: html+django
+
+ {% load static %}
+ {% static "images/hi.jpg" as myphoto %}
+ <img src="{{ myphoto }}"></img>
+
.. note::
The :mod:`staticfiles<django.contrib.staticfiles>` contrib app also ships
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt
index b323f0629f..c2f2025bc3 100644
--- a/docs/ref/utils.txt
+++ b/docs/ref/utils.txt
@@ -112,10 +112,14 @@ to distinguish caches by the ``Accept-language`` header.
.. method:: insert(index, key, value)
+ .. deprecated:: 1.5
+
Inserts the key, value pair before the item with the given index.
.. method:: value_for_index(index)
+ .. deprecated:: 1.5
+
Returns the value of the item at the given zero-based index.
Creating a new SortedDict
@@ -246,13 +250,13 @@ For simplifying the selection of a generator use ``feedgenerator.DefaultFeed``
which is currently ``Rss201rev2Feed``
For definitions of the different versions of RSS, see:
-http://diveintomark.org/archives/2004/02/04/incompatible-rss
+http://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004/02/04/incompatible-rss
.. function:: get_tag_uri(url, date)
Creates a TagURI.
- See http://diveintomark.org/archives/2004/05/28/howto-atom-id
+ See http://web.archive.org/web/20110514113830/http://diveintomark.org/archives/2004/05/28/howto-atom-id
SyndicationFeed
---------------
@@ -330,7 +334,7 @@ Rss201rev2Feed
.. class:: Rss201rev2Feed(RssFeed)
- Spec: http://blogs.law.harvard.edu/tech/rss
+ Spec: http://cyber.law.harvard.edu/rss/rss.html
RssUserland091Feed
------------------
@@ -387,6 +391,67 @@ Atom1Feed
input is a proper string, then add support for lazy translation objects at the
end.
+``django.utils.html``
+=====================
+
+.. module:: django.utils.html
+ :synopsis: HTML helper functions
+
+Usually you should build up HTML using Django's templates to make use of its
+autoescape mechanism, using the utilities in :mod:`django.utils.safestring`
+where appropriate. This module provides some additional low level utilitiesfor
+escaping HTML.
+
+.. function:: escape(text)
+
+ Returns the given text with ampersands, quotes and angle brackets encoded
+ for use in HTML. The input is first passed through
+ :func:`~django.utils.encoding.force_unicode` and the output has
+ :func:`~django.utils.safestring.mark_safe` applied.
+
+.. function:: conditional_escape(text)
+
+ Similar to ``escape()``, except that it doesn't operate on pre-escaped strings,
+ so it will not double escape.
+
+.. function:: format_html(format_string, *args, **kwargs)
+
+ This is similar to `str.format`_, except that it is appropriate for
+ building up HTML fragments. All args and kwargs are passed through
+ :func:`conditional_escape` before being passed to ``str.format``.
+
+ For the case of building up small HTML fragments, this function is to be
+ preferred over string interpolation using ``%`` or ``str.format`` directly,
+ because it applies escaping to all arguments - just like the Template system
+ applies escaping by default.
+
+ So, instead of writing:
+
+ .. code-block:: python
+
+ mark_safe(u"%s <b>%s</b> %s" % (some_html,
+ escape(some_text),
+ escape(some_other_text),
+ ))
+
+ you should instead use:
+
+ .. code-block:: python
+
+ format_html(u"%{0} <b>{1}</b> {2}",
+ mark_safe(some_html), some_text, some_other_text)
+
+ This has the advantage that you don't need to apply :func:`escape` to each
+ argument and risk a bug and an XSS vulnerability if you forget one.
+
+ Note that although this function uses ``str.format`` to do the
+ interpolation, some of the formatting options provided by `str.format`_
+ (e.g. number formatting) will not work, since all arguments are passed
+ through :func:`conditional_escape` which (ultimately) calls
+ :func:`~django.utils.encoding.force_unicode` on the values.
+
+
+.. _str.format: http://docs.python.org/library/stdtypes.html#str.format
``django.utils.http``
=====================