summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2013-05-10 12:55:30 +0100
committerAndrew Godwin <andrew@aeracode.org>2013-05-10 12:55:30 +0100
commitcb4b0de49e027f09f8abe63e2fa43f60fc1ef13f (patch)
tree712da07b2b80fc503aea683c096a8774dceaad01 /docs/ref
parentf6801a234fb9460eac80d146534ac340e178c466 (diff)
parentbdd285723f9b0044eca690634c412c1c3eec76c0 (diff)
Merge branch 'master' into schema-alteration
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/class-based-views/base.txt1
-rw-r--r--docs/ref/class-based-views/generic-date-based.txt2
-rw-r--r--docs/ref/class-based-views/generic-editing.txt2
-rw-r--r--docs/ref/class-based-views/mixins-date-based.txt1
-rw-r--r--docs/ref/class-based-views/mixins-editing.txt20
-rw-r--r--docs/ref/class-based-views/mixins-simple.txt1
-rw-r--r--docs/ref/clickjacking.txt1
-rw-r--r--docs/ref/contrib/admin/index.txt41
-rw-r--r--docs/ref/contrib/contenttypes.txt24
-rw-r--r--docs/ref/contrib/gis/geoquerysets.txt1
-rw-r--r--docs/ref/contrib/gis/geos.txt2
-rw-r--r--docs/ref/contrib/gis/install/geolibs.txt2
-rw-r--r--docs/ref/contrib/sites.txt1
-rw-r--r--docs/ref/databases.txt50
-rw-r--r--docs/ref/django-admin.txt19
-rw-r--r--docs/ref/exceptions.txt1
-rw-r--r--docs/ref/forms/fields.txt12
-rw-r--r--docs/ref/forms/models.txt12
-rw-r--r--docs/ref/forms/validation.txt8
-rw-r--r--docs/ref/forms/widgets.txt1
-rw-r--r--docs/ref/middleware.txt1
-rw-r--r--docs/ref/models/fields.txt5
-rw-r--r--docs/ref/models/instances.txt5
-rw-r--r--docs/ref/models/querysets.txt35
-rw-r--r--docs/ref/request-response.txt19
-rw-r--r--docs/ref/settings.txt47
-rw-r--r--docs/ref/template-response.txt14
-rw-r--r--docs/ref/templates/api.txt1
-rw-r--r--docs/ref/templates/builtins.txt48
-rw-r--r--docs/ref/unicode.txt28
-rw-r--r--docs/ref/views.txt2
31 files changed, 262 insertions, 145 deletions
diff --git a/docs/ref/class-based-views/base.txt b/docs/ref/class-based-views/base.txt
index 2073458314..3ba7c38c43 100644
--- a/docs/ref/class-based-views/base.txt
+++ b/docs/ref/class-based-views/base.txt
@@ -105,6 +105,7 @@ TemplateView
in the URL.
.. versionchanged:: 1.5
+
The context used to be populated with a ``{{ params }}`` dictionary of
the parameters captured in the URL. Now those parameters are first-level
context variables.
diff --git a/docs/ref/class-based-views/generic-date-based.txt b/docs/ref/class-based-views/generic-date-based.txt
index 4144c382f8..4dcb788779 100644
--- a/docs/ref/class-based-views/generic-date-based.txt
+++ b/docs/ref/class-based-views/generic-date-based.txt
@@ -142,7 +142,7 @@ YearArchiveView
.. versionchanged:: 1.5
- Previously, this returned a string.
+ Previously, this returned a string.
* ``next_year``: A :class:`~datetime.date` object
representing the first day of the next year, according to
diff --git a/docs/ref/class-based-views/generic-editing.txt b/docs/ref/class-based-views/generic-editing.txt
index 1dbb427036..555ba40cfb 100644
--- a/docs/ref/class-based-views/generic-editing.txt
+++ b/docs/ref/class-based-views/generic-editing.txt
@@ -110,6 +110,7 @@ CreateView
class AuthorCreate(CreateView):
model = Author
+ fields = ['name']
UpdateView
----------
@@ -152,6 +153,7 @@ UpdateView
class AuthorUpdate(UpdateView):
model = Author
+ fields = ['name']
DeleteView
----------
diff --git a/docs/ref/class-based-views/mixins-date-based.txt b/docs/ref/class-based-views/mixins-date-based.txt
index 75f2a77615..1a1a4d531b 100644
--- a/docs/ref/class-based-views/mixins-date-based.txt
+++ b/docs/ref/class-based-views/mixins-date-based.txt
@@ -330,5 +330,6 @@ BaseDateListView
:meth:`QuerySet.dates()<django.db.models.query.QuerySet.dates>`.
.. versionchanged:: 1.5
+
The ``ordering`` parameter was added, and the default order was
changed to ascending.
diff --git a/docs/ref/class-based-views/mixins-editing.txt b/docs/ref/class-based-views/mixins-editing.txt
index a4175369aa..51d8628818 100644
--- a/docs/ref/class-based-views/mixins-editing.txt
+++ b/docs/ref/class-based-views/mixins-editing.txt
@@ -116,6 +116,18 @@ ModelFormMixin
by examining ``self.object`` or
:attr:`~django.views.generic.detail.SingleObjectMixin.queryset`.
+ .. attribute:: fields
+
+ .. versionadded:: 1.6
+
+ A list of names of fields. This is interpreted the same way as the
+ ``Meta.fields`` attribute of :class:`~django.forms.ModelForm`.
+
+ This is a required attribute if you are generating the form class
+ automatically (e.g. using ``model``). Omitting this attribute will
+ result in all fields being used, but this behaviour is deprecated
+ and will be removed in Django 1.8.
+
.. attribute:: success_url
The URL to redirect to when the form is successfully processed.
@@ -206,10 +218,10 @@ ProcessFormView
.. versionadded:: 1.6
- ``success_url`` may contain dictionary string formatting, which
- will be interpolated against the object's field attributes. For
- example, you could use ``success_url="/parent/%(parent_id)s/"`` to
- redirect to a URL composed out of the ``parent_id`` field on a model.
+ ``success_url`` may contain dictionary string formatting, which
+ will be interpolated against the object's field attributes. For
+ example, you could use ``success_url="/parent/%(parent_id)s/"`` to
+ redirect to a URL composed out of the ``parent_id`` field on a model.
.. method:: get_success_url()
diff --git a/docs/ref/class-based-views/mixins-simple.txt b/docs/ref/class-based-views/mixins-simple.txt
index 51b0386654..6796675529 100644
--- a/docs/ref/class-based-views/mixins-simple.txt
+++ b/docs/ref/class-based-views/mixins-simple.txt
@@ -67,7 +67,6 @@ TemplateResponseMixin
.. attribute:: content_type
.. versionadded:: 1.5
- The ``content_type`` attribute was added.
The content type to use for the response. ``content_type`` is passed
as a keyword argument to ``response_class``. Default is ``None`` --
diff --git a/docs/ref/clickjacking.txt b/docs/ref/clickjacking.txt
index ce27148ad3..0b81243b92 100644
--- a/docs/ref/clickjacking.txt
+++ b/docs/ref/clickjacking.txt
@@ -62,6 +62,7 @@ To set the same ``X-Frame-Options`` value for all responses in your site, put
)
.. versionchanged:: 1.6
+
This middleware is enabled in the settings file generated by
:djadmin:`startproject`.
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index c567bc1db4..67e498ee91 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -18,6 +18,7 @@ The admin is enabled in the default project template used by
:djadmin:`startproject`.
.. versionchanged:: 1.6
+
In previous versions, the admin wasn't enabled by default.
For reference, here are the requirements:
@@ -336,6 +337,22 @@ subclass::
.. admonition:: Note
+ .. versionchanged:: 1.6
+
+ If you define the ``Meta.model`` attribute on a
+ :class:`~django.forms.ModelForm`, you must also define the
+ ``Meta.fields`` attribute (or the ``Meta.exclude`` attribute). However,
+ since the admin has its own way of defining fields, the ``Meta.fields``
+ attribute will be ignored.
+
+ If the ``ModelForm`` is only going to be used for the admin, the easiest
+ solution is to omit the ``Meta.model`` attribute, since ``ModelAdmin``
+ will provide the correct model to use. Alternatively, you can set
+ ``fields = []`` in the ``Meta`` class to satisfy the validation on the
+ ``ModelForm``.
+
+ .. admonition:: Note
+
If your ``ModelForm`` and ``ModelAdmin`` both define an ``exclude``
option then ``ModelAdmin`` takes precedence::
@@ -1282,13 +1299,24 @@ templates used by the :class:`ModelAdmin` views:
on the changelist page. To use a custom form, for example::
class MyForm(forms.ModelForm):
- class Meta:
- model = MyModel
+ pass
class MyModelAdmin(admin.ModelAdmin):
def get_changelist_form(self, request, **kwargs):
return MyForm
+ .. admonition:: Note
+
+ .. versionchanged:: 1.6
+
+ If you define the ``Meta.model`` attribute on a
+ :class:`~django.forms.ModelForm`, you must also define the
+ ``Meta.fields`` attribute (or the ``Meta.exclude`` attribute). However,
+ ``ModelAdmin`` ignores this value, overriding it with the
+ :attr:`ModelAdmin.list_editable` attribute. The easiest solution is to
+ omit the ``Meta.model`` attribute, since ``ModelAdmin`` will provide the
+ correct model to use.
+
.. method:: ModelAdmin.get_changelist_formset(self, request, **kwargs)
Returns a :ref:`ModelFormSet <model-formsets>` class for use on the
@@ -1341,6 +1369,7 @@ templates used by the :class:`ModelAdmin` views:
return qs.filter(author=request.user)
.. versionchanged:: 1.6
+
The ``get_queryset`` method was previously named ``queryset``.
.. method:: ModelAdmin.message_user(request, message, level=messages.INFO, extra_tags='', fail_silently=False)
@@ -1348,7 +1377,9 @@ templates used by the :class:`ModelAdmin` views:
Sends a message to the user using the :mod:`django.contrib.messages`
backend. See the :ref:`custom ModelAdmin example <custom-admin-action>`.
- .. versionadded:: 1.5
+ .. versionchanged:: 1.5
+
+ Keyword arguments were added in Django 1.5.
Keyword arguments allow you to change the message level, add extra CSS
tags, or fail silently if the ``contrib.messages`` framework is not
@@ -1451,6 +1482,7 @@ in your own admin JavaScript without including a second copy, you can use the
``django.jQuery`` object on changelist and add/edit views.
.. versionchanged:: 1.6
+
The embedded jQuery has been upgraded from 1.4.2 to 1.9.1.
The :class:`ModelAdmin` class requires jQuery by default, so there is no need
@@ -1485,9 +1517,6 @@ needed. Now within your form you can add your own custom validation for
any field::
class MyArticleAdminForm(forms.ModelForm):
- class Meta:
- model = Article
-
def clean_name(self):
# do something that validates your data
return self.cleaned_data["name"]
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt
index 388172c43e..4fa119bc70 100644
--- a/docs/ref/contrib/contenttypes.txt
+++ b/docs/ref/contrib/contenttypes.txt
@@ -234,18 +234,18 @@ lookup::
.. versionadded:: 1.5
-Prior to Django 1.5,
-:meth:`~django.contrib.contenttypes.models.ContentTypeManager.get_for_model` and
-:meth:`~django.contrib.contenttypes.models.ContentTypeManager.get_for_models`
-always returned the :class:`~django.contrib.contenttypes.models.ContentType`
-associated with the concrete model of the specified one(s). That means there
-was no way to retrieve the
-:class:`~django.contrib.contenttypes.models.ContentType` of a proxy model
-using those methods. As of Django 1.5 you can now pass a boolean flag –
-``for_concrete_model`` and ``for_concrete_models`` respectively – to specify
-wether or not you want to retrieve the
-:class:`~django.contrib.contenttypes.models.ContentType` for the concrete or
-direct model.
+ Prior to Django 1.5,
+ :meth:`~django.contrib.contenttypes.models.ContentTypeManager.get_for_model` and
+ :meth:`~django.contrib.contenttypes.models.ContentTypeManager.get_for_models`
+ always returned the :class:`~django.contrib.contenttypes.models.ContentType`
+ associated with the concrete model of the specified one(s). That means there
+ was no way to retrieve the
+ :class:`~django.contrib.contenttypes.models.ContentType` of a proxy model
+ using those methods. As of Django 1.5 you can now pass a boolean flag –
+ ``for_concrete_model`` and ``for_concrete_models`` respectively – to specify
+ wether or not you want to retrieve the
+ :class:`~django.contrib.contenttypes.models.ContentType` for the concrete or
+ direct model.
Generic relations
=================
diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt
index 97217e3c38..5e51e4cbf3 100644
--- a/docs/ref/contrib/gis/geoquerysets.txt
+++ b/docs/ref/contrib/gis/geoquerysets.txt
@@ -950,6 +950,7 @@ __ http://geohash.org/
*Availability*: PostGIS, SpatiaLite
.. versionchanged:: 1.5
+
``geojson`` support for Spatialite > 3.0 has been added.
Attaches a ``geojson`` attribute to every model in the queryset that contains the
diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt
index 4d44638488..12e4e55165 100644
--- a/docs/ref/contrib/gis/geos.txt
+++ b/docs/ref/contrib/gis/geos.txt
@@ -845,7 +845,7 @@ include the SRID value (in other words, EWKB).
.. class:: WKBWriter
``WKBWriter`` provides the most control over its output. By default it
-returns OGC-compliant WKB when it's ``write`` method is called. However,
+returns OGC-compliant WKB when its ``write`` method is called. However,
it has properties that allow for the creation of EWKB, a superset of the
WKB standard that includes additional information.
diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt
index 74ebf6a35f..c9a1b405a3 100644
--- a/docs/ref/contrib/gis/install/geolibs.txt
+++ b/docs/ref/contrib/gis/install/geolibs.txt
@@ -194,7 +194,7 @@ Configure, make and install::
.. note::
- Because GeoDjango has it's own Python interface, the preceding instructions
+ Because GeoDjango has its own Python interface, the preceding instructions
do not build GDAL's own Python bindings. The bindings may be built by
adding the ``--with-python`` flag when running ``configure``. See
`GDAL/OGR In Python`__ for more information on GDAL's bindings.
diff --git a/docs/ref/contrib/sites.txt b/docs/ref/contrib/sites.txt
index 139a9b377f..65838dfa3e 100644
--- a/docs/ref/contrib/sites.txt
+++ b/docs/ref/contrib/sites.txt
@@ -252,6 +252,7 @@ Enabling the sites framework
============================
.. versionchanged:: 1.6
+
In previous versions, the sites framework was enabled by default.
To enable the sites framework, follow these steps:
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index 395abd90dd..7555acaaba 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -22,14 +22,14 @@ Persistent connections
.. versionadded:: 1.6
Persistent connections avoid the overhead of re-establishing a connection to
-the database in each request. By default, connections are kept open for up 10
-minutes — if not specified, :setting:`CONN_MAX_AGE` defaults to 600 seconds.
+the database in each request. They're controlled by the
+:setting:`CONN_MAX_AGE` parameter which defines the maximum lifetime of a
+connection. It can be set independently for each database.
-Django 1.5 and earlier didn't have persistent connections. To restore the
-legacy behavior of closing the connection at the end of every request, set
-:setting:`CONN_MAX_AGE` to ``0``.
-
-For unlimited persistent connections, set :setting:`CONN_MAX_AGE` to ``None``.
+The default value is ``0``, preserving the historical behavior of closing the
+database connection at the end of each request. To enable persistent
+connections, set :setting:`CONN_MAX_AGE` to a positive number of seconds. For
+unlimited persistent connections, set it to ``None``.
Connection management
~~~~~~~~~~~~~~~~~~~~~
@@ -64,13 +64,22 @@ least as many simultaneous connections as you have worker threads.
Sometimes a database won't be accessed by the majority of your views, for
example because it's the database of an external system, or thanks to caching.
-In such cases, you should set :setting:`CONN_MAX_AGE` to a lower value, or
-even ``0``, because it doesn't make sense to maintain a connection that's
-unlikely to be reused. This will help keep the number of simultaneous
-connections to this database small.
+In such cases, you should set :setting:`CONN_MAX_AGE` to a low value or even
+``0``, because it doesn't make sense to maintain a connection that's unlikely
+to be reused. This will help keep the number of simultaneous connections to
+this database small.
The development server creates a new thread for each request it handles,
-negating the effect of persistent connections.
+negating the effect of persistent connections. Don't enable them during
+development.
+
+When Django establishes a connection to the database, it sets up appropriate
+parameters, depending on the backend being used. If you enable persistent
+connections, this setup is no longer repeated every request. If you modify
+parameters such as the connection's isolation level or time zone, you should
+either restore Django's defaults at the end of each request, force an
+appropriate value at the beginning of each request, or disable persistent
+connections.
.. _postgresql-notes:
@@ -182,6 +191,7 @@ Django supports MySQL 5.0.3 and higher.
data on all database schema. Django's ``inspectdb`` feature uses it.
.. versionchanged:: 1.5
+
The minimum version requirement of MySQL 5.0.3 was set in Django 1.5.
Django expects the database to support Unicode (UTF-8 encoding) and delegates to
@@ -251,6 +261,18 @@ required for full MySQL support in Django.
.. _MySQLdb: http://sourceforge.net/projects/mysql-python
+Python 3
+--------
+
+At the time of writing, the latest release of MySQLdb (1.2.4) doesn't support
+Python 3. In order to use MySQL under Python 3, you'll have to install an
+unofficial fork, such as `MySQL-for-Python-3`_.
+
+This port is still in alpha. In particular, it doesn't support binary data,
+making it impossible to use :class:`django.db.models.BinaryField`.
+
+.. _MySQL-for-Python-3: https://github.com/clelland/MySQL-for-Python-3
+
Creating your database
----------------------
@@ -360,8 +382,8 @@ Here's a sample configuration which uses a MySQL option file::
default-character-set = utf8
Several other MySQLdb connection options may be useful, such as ``ssl``,
-``use_unicode``, ``init_command``, and ``sql_mode``. Consult the
-`MySQLdb documentation`_ for more details.
+``init_command``, and ``sql_mode``. Consult the `MySQLdb documentation`_ for
+more details.
.. _MySQL option file: http://dev.mysql.com/doc/refman/5.0/en/option-files.html
.. _MySQLdb documentation: http://mysql-python.sourceforge.net/
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 1d3f1b8d1d..ec49705add 100644
--- a/docs/ref/django-admin.txt
+++ b/docs/ref/django-admin.txt
@@ -98,6 +98,7 @@ Can be run as a cronjob or directly to clean out old data from the database
(only expired sessions at the moment).
.. versionchanged:: 1.5
+
:djadmin:`cleanup` is deprecated. Use :djadmin:`clearsessions` instead.
compilemessages
@@ -122,7 +123,7 @@ Example usage::
.. versionchanged:: 1.6
-Added the ability to specify multiple locales.
+ Added the ability to specify multiple locales.
createcachetable
----------------
@@ -173,6 +174,7 @@ The :djadminopt:`--all` option may be provided to display all settings, even
if they have Django's default value. Such settings are prefixed by ``"###"``.
.. versionadded:: 1.6
+
The :djadminopt:`--all` option was added.
dumpdata <appname appname appname.Model ...>
@@ -307,8 +309,8 @@ database to introspect.
.. versionchanged:: 1.6
-The behavior by which introspected models are created as unmanaged ones is new
-in Django 1.6.
+ The behavior by which introspected models are created as unmanaged ones is new
+ in Django 1.6.
loaddata <fixture fixture ...>
------------------------------
@@ -467,7 +469,7 @@ You can also use commas to separate multiple locales::
.. versionchanged:: 1.6
-Added the ability to specify multiple locales.
+ Added the ability to specify multiple locales.
.. django-admin-option:: --domain
@@ -778,8 +780,6 @@ 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:
@@ -807,9 +807,13 @@ behavior you can use the ``--no-startup`` option. e.g.::
django-admin.py shell --plain --no-startup
+.. versionadded:: 1.5
+
+ The ``--interface`` option was added in Django 1.5.
+
.. versionadded:: 1.6
-The ``--no-startup`` option was added in Django 1.6.
+ The ``--no-startup`` option was added in Django 1.6.
sql <appname appname ...>
-------------------------
@@ -1353,6 +1357,7 @@ for any other exception. If you specify ``--traceback``, ``django-admin.py``
will also output a full stack trace when a ``CommandError`` is raised.
.. versionchanged:: 1.6
+
Previously, Django didn't show a full stack trace by default for exceptions
other than ``CommandError``.
diff --git a/docs/ref/exceptions.txt b/docs/ref/exceptions.txt
index 93bb9ed251..f9a1715180 100644
--- a/docs/ref/exceptions.txt
+++ b/docs/ref/exceptions.txt
@@ -138,6 +138,7 @@ the underlying database exceptions. See :pep:`249`, the Python Database API
Specification v2.0, for further information.
.. versionchanged:: 1.6
+
Previous version of Django only wrapped ``DatabaseError`` and
``IntegrityError``.
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index c8b8044d26..29f889445d 100644
--- a/docs/ref/forms/fields.txt
+++ b/docs/ref/forms/fields.txt
@@ -467,6 +467,11 @@ For each field, we describe the default widget used if you don't specify
The ``max_value`` and ``min_value`` error messages may contain
``%(limit_value)s``, which will be substituted by the appropriate limit.
+ .. versionchanged:: 1.6
+
+ Similarly, the ``max_digits``, ``max_decimal_places`` and
+ ``max_whole_digits`` error messages may contain ``%(max)s``.
+
Takes four optional arguments:
.. attribute:: max_value
@@ -1010,9 +1015,16 @@ objects (in the case of ``ModelMultipleChoiceField``) into the
``invalid_pk_value``
.. versionchanged:: 1.5
+
The empty and normalized values were changed to be consistently
``QuerySets`` instead of ``[]`` and ``QuerySet`` respectively.
+ .. versionchanged:: 1.6
+
+ The ``invalid_choice`` message may contain ``%(value)s`` and the
+ ``invalid_pk_value`` message may contain ``%(pk)s``, which will be
+ substituted by the appropriate values.
+
Allows the selection of one or more model objects, suitable for
representing a many-to-many relation. As with :class:`ModelChoiceField`,
you can use ``label_from_instance`` to customize the object
diff --git a/docs/ref/forms/models.txt b/docs/ref/forms/models.txt
index dd0a422fd0..9b3480758a 100644
--- a/docs/ref/forms/models.txt
+++ b/docs/ref/forms/models.txt
@@ -25,6 +25,14 @@ Model Form Functions
See :ref:`modelforms-factory` for example usage.
+ .. versionchanged:: 1.6
+
+ You must provide the list of fields explicitly, either via keyword arguments
+ ``fields`` or ``exclude``, or the corresponding attributes on the form's
+ inner ``Meta`` class. See :ref:`modelforms-selecting-fields` for more
+ information. Omitting any definition of the fields to use will result in all
+ fields being used, but this behaviour is deprecated.
+
.. function:: modelformset_factory(model, form=ModelForm, formfield_callback=None, formset=BaseModelFormSet, extra=1, can_delete=False, can_order=False, max_num=None, fields=None, exclude=None, widgets=None, validate_max=False)
Returns a ``FormSet`` class for the given ``model`` class.
@@ -42,7 +50,7 @@ Model Form Functions
.. versionchanged:: 1.6
- The ``widgets`` and the ``validate_max`` parameters were added.
+ The ``widgets`` and the ``validate_max`` parameters were added.
.. function:: inlineformset_factory(parent_model, model, form=ModelForm, formset=BaseInlineFormSet, fk_name=None, fields=None, exclude=None, extra=3, can_order=False, can_delete=True, max_num=None, formfield_callback=None, widgets=None, validate_max=False)
@@ -57,4 +65,4 @@ Model Form Functions
.. versionchanged:: 1.6
- The ``widgets`` and the ``validate_max`` parameters were added.
+ The ``widgets`` and the ``validate_max`` parameters were added.
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
index 978c985b55..3aaa69b6ea 100644
--- a/docs/ref/forms/validation.txt
+++ b/docs/ref/forms/validation.txt
@@ -359,7 +359,7 @@ considering aren't valid, we must remember to remove them from the
.. versionchanged:: 1.5
-Django used to remove the ``cleaned_data`` attribute entirely if there were
-any errors in the form. Since version 1.5, ``cleaned_data`` is present even if
-the form doesn't validate, but it contains only field values that did
-validate.
+ Django used to remove the ``cleaned_data`` attribute entirely if there were
+ any errors in the form. Since version 1.5, ``cleaned_data`` is present even if
+ the form doesn't validate, but it contains only field values that did
+ validate.
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index 514e8b3dc0..678f2e6949 100644
--- a/docs/ref/forms/widgets.txt
+++ b/docs/ref/forms/widgets.txt
@@ -522,6 +522,7 @@ Selector and checkbox widgets
``True`` if the checkbox should be checked for that value.
.. versionchanged:: 1.5
+
Exceptions from ``check_test`` used to be silenced by its caller,
this is no longer the case, they will propagate upwards.
diff --git a/docs/ref/middleware.txt b/docs/ref/middleware.txt
index 20bb2fb751..03885a2215 100644
--- a/docs/ref/middleware.txt
+++ b/docs/ref/middleware.txt
@@ -206,6 +206,7 @@ Transaction middleware
.. class:: TransactionMiddleware
.. versionchanged:: 1.6
+
``TransactionMiddleware`` is deprecated. The documentation of transactions
contains :ref:`upgrade instructions <transactions-upgrading-from-1.5>`.
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 7ef251c907..d322904ec9 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -378,6 +378,7 @@ If you need to accept :attr:`~Field.null` values then use
:class:`NullBooleanField` instead.
.. versionchanged:: 1.6
+
The default value of ``BooleanField`` was changed from ``False`` to
``None`` when :attr:`Field.default` isn't defined.
@@ -956,8 +957,8 @@ Like all :class:`CharField` subclasses, :class:`URLField` takes the optional
.. versionadded:: 1.5
-The current value of the field will be displayed as a clickable link above the
-input widget.
+ The current value of the field will be displayed as a clickable link above the
+ input widget.
Relationship fields
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index 9f583c42ac..b4b162a9ea 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -297,8 +297,9 @@ follows this algorithm:
didn't update anything, Django executes an ``INSERT``.
.. versionchanged:: 1.6
- Previously Django used ``SELECT`` - if not found ``INSERT`` else ``UPDATE``
- algorithm. The old algorithm resulted in one more query in ``UPDATE`` case.
+
+ Previously Django used ``SELECT`` - if not found ``INSERT`` else ``UPDATE``
+ algorithm. The old algorithm resulted in one more query in ``UPDATE`` case.
The one gotcha here is that you should be careful not to specify a primary-key
value explicitly when saving new objects, if you cannot guarantee the
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 9c1337d59f..d27214a66c 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -554,11 +554,13 @@ Returns a ``DateQuerySet`` — a ``QuerySet`` that evaluates to a list of
particular kind within the contents of the ``QuerySet``.
.. versionchanged:: 1.6
+
``dates`` used to return a list of :class:`datetime.datetime` objects.
``field`` should be the name of a ``DateField`` of your model.
.. versionchanged:: 1.6
+
``dates`` used to accept operating on a ``DateTimeField``.
``kind`` should be either ``"year"``, ``"month"`` or ``"day"``. Each
@@ -625,7 +627,8 @@ object. If it's ``None``, Django uses the :ref:`current time zone
- SQLite: install pytz_ — conversions are actually performed in Python.
- PostgreSQL: no requirements (see `Time Zones`_).
- Oracle: no requirements (see `Choosing a Time Zone File`_).
- - MySQL: load the time zone tables with `mysql_tzinfo_to_sql`_.
+ - MySQL: install pytz_ and load the time zone tables with
+ `mysql_tzinfo_to_sql`_.
.. _pytz: http://pytz.sourceforge.net/
.. _Time Zones: http://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-TIMEZONES
@@ -1121,11 +1124,11 @@ to ``defer()``::
.. 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, doing so will result in an error.
+ 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, doing so will result in an error.
.. note::
@@ -1193,20 +1196,20 @@ 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. Also note that using :meth:`only` and omitting a field requested
-using :meth:`select_related` is an error as well.
+options.
.. versionchanged:: 1.5
-.. note::
+ Using :meth:`only` and omitting a field requested using
+ :meth:`select_related` is an error as well.
- When calling :meth:`~django.db.models.Model.save()` for instances with
- deferred fields, only the loaded fields will be saved. See
- :meth:`~django.db.models.Model.save()` for more details.
+ .. note::
+
+ When calling :meth:`~django.db.models.Model.save()` for instances with
+ deferred fields, only the loaded fields will be saved. See
+ :meth:`~django.db.models.Model.save()` for more details.
using
~~~~~
@@ -1424,6 +1427,7 @@ 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.
.. versionadded:: 1.5
+
The ``batch_size`` parameter was added in version 1.5.
count
@@ -1725,7 +1729,8 @@ methods on your models. It does, however, emit the
(including cascaded deletions).
.. versionadded:: 1.5
- Allow fast-path deletion of objects
+
+ Allow fast-path deletion of objects.
Django needs to fetch objects into memory to send signals and handle cascades.
However, if there are no cascades and no signals, then Django may take a
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 0f62741c5d..2fac7f2f9c 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -94,6 +94,7 @@ All attributes should be considered read-only, unless stated otherwise below.
:attr:`HttpRequest.body` attribute instead.
.. versionchanged:: 1.5
+
Before Django 1.5, HttpRequest.POST contained non-form data.
It's possible that a request can come in via POST with an empty ``POST``
@@ -563,19 +564,19 @@ streaming response if (and only if) no middleware accesses the
.. versionchanged:: 1.5
-This technique is fragile and was deprecated in Django 1.5. If you need the
-response to be streamed from the iterator to the client, you should use the
-:class:`StreamingHttpResponse` class instead.
+ This technique is fragile and was deprecated in Django 1.5. If you need the
+ response to be streamed from the iterator to the client, you should use the
+ :class:`StreamingHttpResponse` class instead.
-As of Django 1.7, when :class:`HttpResponse` is instantiated with an
-iterator, it will consume it immediately, store the response content as a
-string, and discard the iterator.
+ As of Django 1.7, when :class:`HttpResponse` is instantiated with an
+ iterator, it will consume it immediately, store the response content as a
+ string, and discard the iterator.
.. versionchanged:: 1.5
-You can now use :class:`HttpResponse` as a file-like object even if it was
-instantiated with an iterator. Django will consume and save the content of
-the iterator on first access.
+ You can now use :class:`HttpResponse` as a file-like object even if it was
+ instantiated with an iterator. Django will consume and save the content of
+ the iterator on first access.
Setting headers
~~~~~~~~~~~~~~~
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index 1fc9d2ff92..04b42aeeb2 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -67,7 +67,7 @@ A list of strings representing the host/domain names that this Django site can
serve. This is a security measure to prevent an attacker from poisoning caches
and password reset emails with links to malicious hosts by submitting requests
with a fake HTTP ``Host`` header, which is possible even under many
-seemingly-safe webserver configurations.
+seemingly-safe web server configurations.
Values in this list can be fully qualified names (e.g. ``'www.example.com'``),
in which case they will be matched against the request's ``Host`` header
@@ -79,6 +79,20 @@ responsible to provide your own validation of the ``Host`` header (perhaps in a
middleware; if so this middleware must be listed first in
:setting:`MIDDLEWARE_CLASSES`).
+.. note::
+
+ If you want to also allow the `fully qualified domain name (FQDN)`_, which
+ some browsers can send in the Host header, you must explicitly add another
+ ALLOWED_HOSTS entry that includes a trailing period. This entry can also be
+ a subdomain wildcard::
+
+ ALLOWED_HOSTS = [
+ '.example.com', # Allow domain and subdomains
+ '.example.com.', # Also allow FQDN and subdomains
+ ]
+
+.. _`fully qualified domain name (FQDN)`: http://en.wikipedia.org/wiki/Fully_qualified_domain_name
+
If the ``Host`` header (or ``X-Forwarded-Host`` if
:setting:`USE_X_FORWARDED_HOST` is enabled) does not match any value in this
list, the :meth:`django.http.HttpRequest.get_host()` method will raise
@@ -495,7 +509,7 @@ CONN_MAX_AGE
.. versionadded:: 1.6
-Default: ``600``
+Default: ``0``
The lifetime of a database connection, in seconds. Use ``0`` to close database
connections at the end of each request — Django's historical behavior — and
@@ -1265,9 +1279,9 @@ see the current list of translated languages by looking in
.. _online source: https://github.com/django/django/blob/master/django/conf/global_settings.py
-The list is a tuple of two-tuples in the format
-(:term:`language code<language code>`, ``language name``) -- for example,
-``('ja', 'Japanese')``.
+The list is a tuple of two-tuples in the format
+(:term:`language code<language code>`, ``language name``) -- for example,
+``('ja', 'Japanese')``.
This specifies which languages are available for language selection. See
:doc:`/topics/i18n/index`.
@@ -1486,6 +1500,7 @@ randomly-generated ``SECRET_KEY`` to each new project.
execution vulnerabilities.
.. versionchanged:: 1.5
+
Django will now refuse to start if :setting:`SECRET_KEY` is not set.
.. setting:: SECURE_PROXY_SSL_HEADER
@@ -1771,7 +1786,7 @@ See also :setting:`DATE_INPUT_FORMATS` and :setting:`DATETIME_INPUT_FORMATS`.
.. versionchanged:: 1.6
-Input format with microseconds has been added.
+ Input format with microseconds has been added.
.. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
@@ -2055,11 +2070,11 @@ decorator, for example.
.. versionchanged:: 1.5
-This setting now also accepts view function names and
-:ref:`named URL patterns <naming-url-patterns>` which can be used to reduce
-configuration duplication since you no longer have to define the URL in two
-places (``settings`` and URLconf).
-For backward compatibility reasons the default remains unchanged.
+ This setting now also accepts view function names and
+ :ref:`named URL patterns <naming-url-patterns>` which can be used to reduce
+ configuration duplication since you no longer have to define the URL in two
+ places (``settings`` and URLconf).
+ For backward compatibility reasons the default remains unchanged.
.. setting:: LOGIN_URL
@@ -2073,11 +2088,11 @@ The URL where requests are redirected for login, especially when using the
.. versionchanged:: 1.5
-This setting now also accepts view function names and
-:ref:`named URL patterns <naming-url-patterns>` which can be used to reduce
-configuration duplication since you no longer have to define the URL in two
-places (``settings`` and URLconf).
-For backward compatibility reasons the default remains unchanged.
+ This setting now also accepts view function names and
+ :ref:`named URL patterns <naming-url-patterns>` which can be used to reduce
+ configuration duplication since you no longer have to define the URL in two
+ places (``settings`` and URLconf).
+ For backward compatibility reasons the default remains unchanged.
.. setting:: LOGOUT_URL
diff --git a/docs/ref/template-response.txt b/docs/ref/template-response.txt
index 5c13ec7d96..cdefe2fae8 100644
--- a/docs/ref/template-response.txt
+++ b/docs/ref/template-response.txt
@@ -78,13 +78,13 @@ Methods
.. versionchanged:: 1.5
- Historically, this parameter was only called ``mimetype`` (now
- deprecated), 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,
- :setting:`DEFAULT_CONTENT_TYPE` is used.
+ Historically, this parameter was only called ``mimetype`` (now
+ deprecated), 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,
+ :setting:`DEFAULT_CONTENT_TYPE` is used.
.. method:: SimpleTemplateResponse.resolve_context(context)
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 0162f78eed..677aa13cbb 100644
--- a/docs/ref/templates/api.txt
+++ b/docs/ref/templates/api.txt
@@ -272,6 +272,7 @@ Every context contains ``True``, ``False`` and ``None``. As you would expect,
these variables resolve to the corresponding Python objects.
.. versionadded:: 1.5
+
Before Django 1.5, these variables weren't a special case, and they
resolved to ``None`` unless you defined them in the context.
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index 123e114c4a..287fd4f59e 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -176,7 +176,7 @@ just declare the cycle, but not output the first value, you can add a
This will output a list of ``<tr>`` elements with ``class``
alternating between ``row1`` and ``row2``; the subtemplate will have
-access to ``rowcolors`` in it's context that matches the class of the
+access to ``rowcolors`` in its context that matches the class of the
``<tr>`` that encloses it. If the ``silent`` keyword were to be
omitted, ``row1`` would be emitted as normal text, outside the
``<tr>`` element.
@@ -191,19 +191,19 @@ call to ``{% cycle %}`` doesn't specify silent::
.. versionchanged:: 1.6
-To improve safety, future versions of ``cycle`` will automatically escape
-their output. You're encouraged to activate this behavior by loading
-``cycle`` from the ``future`` template library::
+ To improve safety, future versions of ``cycle`` will automatically escape
+ their output. You're encouraged to activate this behavior by loading
+ ``cycle`` from the ``future`` template library::
- {% load cycle from future %}
+ {% load cycle from future %}
-When using the ``future`` version, you can disable auto-escaping with::
+ When using the ``future`` version, you can disable auto-escaping with::
- {% for o in some_list %}
- <tr class="{% autoescape off %}{% cycle rowvalue1 rowvalue2 %}{% endautoescape %}">
- ...
- </tr>
- {% endfor %}
+ {% for o in some_list %}
+ <tr class="{% autoescape off %}{% cycle rowvalue1 rowvalue2 %}{% endautoescape %}">
+ ...
+ </tr>
+ {% endfor %}
.. templatetag:: debug
@@ -294,21 +294,21 @@ to escape the variables in the firstof tag, you must do so explicitly::
.. versionchanged:: 1.6
-To improve safety, future versions of ``firstof`` will automatically escape
-their output. You're encouraged to activate this behavior by loading
-``firstof`` from the ``future`` template library::
+ To improve safety, future versions of ``firstof`` will automatically escape
+ their output. You're encouraged to activate this behavior by loading
+ ``firstof`` from the ``future`` template library::
- {% load firstof from future %}
+ {% load firstof from future %}
-When using the ``future`` version, you can disable auto-escaping with::
+ When using the ``future`` version, you can disable auto-escaping with::
- {% autoescape off %}
- {% firstof var1 var2 var3 "<strong>fallback value</strong>" %}
- {% endautoescape %}
+ {% autoescape off %}
+ {% firstof var1 var2 var3 "<strong>fallback value</strong>" %}
+ {% endautoescape %}
-Or if only some variables should be escaped, you can use::
+ Or if only some variables should be escaped, you can use::
- {% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}
+ {% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}
.. templatetag:: for
@@ -657,11 +657,6 @@ The arguments can be hard-coded strings, so the following is valid::
...
{% endifequal %}
-It is only possible to compare an argument to template variables or strings.
-You cannot check for equality with Python objects such as ``True`` or
-``False``. If you need to test if something is true or false, use the
-:ttag:`if` tag instead.
-
An alternative to the ``ifequal`` tag is to use the :ttag:`if` tag and the
``==`` operator.
@@ -1065,6 +1060,7 @@ by the context as to the current application.
Don't forget to put quotes around the function path or pattern name!
.. versionchanged:: 1.5
+
The first parameter used not to be quoted, which was inconsistent with
other template tags. Since Django 1.5, it is evaluated according to
the usual rules: it can be a quoted string or a variable that will be
diff --git a/docs/ref/unicode.txt b/docs/ref/unicode.txt
index bd5bdc96a9..e5074285e4 100644
--- a/docs/ref/unicode.txt
+++ b/docs/ref/unicode.txt
@@ -47,26 +47,26 @@ You can use Unicode strings, or you can use normal strings (sometimes called
.. versionchanged:: 1.5
-In Python 3, the logic is reversed, that is normal strings are Unicode, and
-when you want to specifically create a bytestring, you have to prefix the
-string with a 'b'. As we are doing in Django code from version 1.5,
-we recommend that you import ``unicode_literals`` from the __future__ library
-in your code. Then, when you specifically want to create a bytestring literal,
-prefix the string with 'b'.
+ In Python 3, the logic is reversed, that is normal strings are Unicode, and
+ when you want to specifically create a bytestring, you have to prefix the
+ string with a 'b'. As we are doing in Django code from version 1.5,
+ we recommend that you import ``unicode_literals`` from the __future__ library
+ in your code. Then, when you specifically want to create a bytestring literal,
+ prefix the string with 'b'.
-Python 2 legacy::
+ Python 2 legacy::
- my_string = "This is a bytestring"
- my_unicode = u"This is an Unicode string"
+ my_string = "This is a bytestring"
+ my_unicode = u"This is an Unicode string"
-Python 2 with unicode literals or Python 3::
+ Python 2 with unicode literals or Python 3::
- from __future__ import unicode_literals
+ from __future__ import unicode_literals
- my_string = b"This is a bytestring"
- my_unicode = "This is an Unicode string"
+ my_string = b"This is a bytestring"
+ my_unicode = "This is an Unicode string"
-See also :doc:`Python 3 compatibility </topics/python3>`.
+ See also :doc:`Python 3 compatibility </topics/python3>`.
.. warning::
diff --git a/docs/ref/views.txt b/docs/ref/views.txt
index 3753f83f07..8c9c3e3ed8 100644
--- a/docs/ref/views.txt
+++ b/docs/ref/views.txt
@@ -18,7 +18,7 @@ convenience, you'd like to have Django serve for you in local development.
The :func:`~django.views.static.serve` view can be used to serve any directory
you give it. (This view is **not** hardened for production use and should be
used only as a development aid; you should serve these files in production
-using a real front-end webserver).
+using a real front-end web server).
The most likely example is user-uploaded content in :setting:`MEDIA_ROOT`.
``django.contrib.staticfiles`` is intended for static assets and has no