2015-09-20 00:34:58 +00:00
|
|
|
=============================================
|
|
|
|
Django 1.10 release notes - UNDER DEVELOPMENT
|
|
|
|
=============================================
|
|
|
|
|
|
|
|
Welcome to Django 1.10!
|
|
|
|
|
|
|
|
These release notes cover the `new features`_, as well as some `backwards
|
|
|
|
incompatible changes`_ you'll want to be aware of when upgrading from Django
|
|
|
|
1.9 or older versions. We've :ref:`dropped some features<removed-features-1.10>`
|
|
|
|
that have reached the end of their deprecation cycle, and we've `begun the
|
|
|
|
deprecation process for some features`_.
|
|
|
|
|
|
|
|
.. _`new features`: `What's new in Django 1.10`_
|
|
|
|
.. _`backwards incompatible changes`: `Backwards incompatible changes in 1.10`_
|
|
|
|
.. _`dropped some features`: `Features removed in 1.10`_
|
|
|
|
.. _`begun the deprecation process for some features`: `Features deprecated in 1.10`_
|
|
|
|
|
|
|
|
Python compatibility
|
|
|
|
====================
|
|
|
|
|
|
|
|
Like Django 1.9, Django 1.10 requires Python 2.7, 3.4, or 3.5. We **highly
|
|
|
|
recommend** and only officially support the latest release of each series.
|
|
|
|
|
|
|
|
What's new in Django 1.10
|
|
|
|
=========================
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
Minor features
|
2016-01-03 10:56:22 +00:00
|
|
|
--------------
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
:mod:`django.contrib.admin`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-13 06:52:49 +00:00
|
|
|
* For sites running on a subpath, the default :attr:`URL for the "View site"
|
|
|
|
link <django.contrib.admin.AdminSite.site_url>` at the top of each admin page
|
|
|
|
will now point to ``request.META['SCRIPT_NAME']`` if set, instead of ``/``.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-09-07 09:51:03 +00:00
|
|
|
* The success message that appears after adding or editing an object now
|
|
|
|
contains a link to the object's change form.
|
|
|
|
|
2015-11-23 10:46:19 +00:00
|
|
|
* All inline JavaScript is removed so you can enable the
|
|
|
|
``Content-Security-Policy`` HTTP header if you wish.
|
|
|
|
|
2015-11-07 15:46:50 +00:00
|
|
|
* The new :attr:`InlineModelAdmin.classes
|
|
|
|
<django.contrib.admin.InlineModelAdmin.classes>` attribute allows specifying
|
|
|
|
classes on inline fieldsets. Inlines with a ``collapse`` class will be
|
|
|
|
initially collapsed and their header will have a small "show" link.
|
|
|
|
|
2015-11-07 11:31:06 +00:00
|
|
|
* If a user doesn't have the add permission, the ``object-tools`` block on a
|
|
|
|
model's changelist will now be rendered (without the add button, of course).
|
|
|
|
This makes it easier to add custom tools in this case.
|
|
|
|
|
2015-12-26 18:51:22 +00:00
|
|
|
* The :class:`~django.contrib.admin.models.LogEntry` model now stores change
|
|
|
|
messages in a JSON structure so that the message can be dynamically translated
|
|
|
|
using the current active language. A new ``LogEntry.get_change_message()``
|
|
|
|
method is now the preferred way of retrieving the change message.
|
|
|
|
|
2016-01-28 00:43:04 +00:00
|
|
|
* Selected objects for fields in ``ModelAdmin.raw_id_fields`` now have a link
|
|
|
|
to object's change form.
|
|
|
|
|
2016-01-14 08:26:44 +00:00
|
|
|
* Added "No date" and "Has date" choices for ``DateFieldListFilter`` if the
|
|
|
|
field is nullable.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
:mod:`django.contrib.admindocs`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.auth`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-09-20 00:42:44 +00:00
|
|
|
* The default iteration count for the PBKDF2 password hasher has been increased
|
|
|
|
by 25%. This backwards compatible change will not affect users who have
|
|
|
|
subclassed ``django.contrib.auth.hashers.PBKDF2PasswordHasher`` to change the
|
|
|
|
default value.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-01 19:52:18 +00:00
|
|
|
* The :func:`~django.contrib.auth.views.logout` view sends "no-cache" headers
|
|
|
|
to prevent an issue where Safari caches redirects and prevents a user from
|
|
|
|
being able to log out.
|
|
|
|
|
2015-07-05 20:54:25 +00:00
|
|
|
* Added the optional ``backend`` argument to :func:`~django.contrib.auth.login`
|
2016-01-07 16:06:19 +00:00
|
|
|
to allow using it without credentials.
|
2015-07-05 20:54:25 +00:00
|
|
|
|
2015-08-26 06:07:06 +00:00
|
|
|
* The new :setting:`LOGOUT_REDIRECT_URL` setting controls the redirect of the
|
|
|
|
:func:`~django.contrib.auth.views.logout` view, if the view doesn't get a
|
|
|
|
``next_page`` argument.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
:mod:`django.contrib.contenttypes`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.gis`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-06 20:05:53 +00:00
|
|
|
* :ref:`Distance lookups <distance-lookups>` now accept expressions as the
|
|
|
|
distance value parameter.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-09 17:36:12 +00:00
|
|
|
* The new :attr:`GEOSGeometry.unary_union
|
|
|
|
<django.contrib.gis.geos.GEOSGeometry.unary_union>` property computes the
|
|
|
|
union of all the elements of this geometry.
|
|
|
|
|
2015-11-20 10:11:25 +00:00
|
|
|
* Added the :meth:`GEOSGeometry.covers()
|
|
|
|
<django.contrib.gis.geos.GEOSGeometry.covers>` binary predicate.
|
|
|
|
|
2015-11-24 14:48:00 +00:00
|
|
|
* Added the :meth:`GDALBand.statistics()
|
|
|
|
<django.contrib.gis.gdal.GDALBand.statistics>` method and
|
|
|
|
:attr:`~django.contrib.gis.gdal.GDALBand.mean`
|
|
|
|
and :attr:`~django.contrib.gis.gdal.GDALBand.std` attributes.
|
|
|
|
|
2015-12-01 03:08:41 +00:00
|
|
|
* Added support for the :class:`~django.contrib.gis.db.models.MakeLine`
|
2015-12-04 04:52:16 +00:00
|
|
|
aggregate and :class:`~django.contrib.gis.db.models.functions.GeoHash`
|
|
|
|
function on SpatiaLite.
|
2015-12-01 03:08:41 +00:00
|
|
|
|
2015-12-03 05:42:22 +00:00
|
|
|
* Added support for the
|
|
|
|
:class:`~django.contrib.gis.db.models.functions.Difference`,
|
|
|
|
:class:`~django.contrib.gis.db.models.functions.Intersection`, and
|
|
|
|
:class:`~django.contrib.gis.db.models.functions.SymDifference`
|
|
|
|
functions on MySQL.
|
|
|
|
|
2015-11-24 09:21:32 +00:00
|
|
|
* Added support for instantiating empty GEOS geometries.
|
|
|
|
|
2015-12-05 14:05:52 +00:00
|
|
|
* The new :attr:`~django.contrib.gis.geos.WKTWriter.trim` and
|
|
|
|
:attr:`~django.contrib.gis.geos.WKTWriter.precision` properties
|
|
|
|
of :class:`~django.contrib.gis.geos.WKTWriter` allow controlling
|
|
|
|
output of the fractional part of the coordinates in WKT.
|
|
|
|
|
2015-12-18 10:26:22 +00:00
|
|
|
* Added the :attr:`LineString.closed
|
|
|
|
<django.contrib.gis.geos.LineString.closed>` and
|
|
|
|
:attr:`MultiLineString.closed
|
|
|
|
<django.contrib.gis.geos.MultiLineString.closed>` properties.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
:mod:`django.contrib.messages`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.postgres`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2016-01-25 12:30:40 +00:00
|
|
|
* For convenience, :class:`~django.contrib.postgres.fields.HStoreField` now
|
|
|
|
casts its keys and values to strings.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
:mod:`django.contrib.redirects`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.sessions`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-03-23 11:52:17 +00:00
|
|
|
* The :djadmin:`clearsessions` management command now removes file-based
|
|
|
|
sessions.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
:mod:`django.contrib.sitemaps`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.sites`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-06 22:55:44 +00:00
|
|
|
* The :class:`~django.contrib.sites.models.Site` model now supports
|
|
|
|
:ref:`natural keys <topics-serialization-natural-keys>`.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
:mod:`django.contrib.staticfiles`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-07 11:24:38 +00:00
|
|
|
* The :ttag:`static` template tag now uses ``django.contrib.staticfiles``
|
|
|
|
if it's in ``INSTALLED_APPS``. This is especially useful for third-party apps
|
|
|
|
which can now always use ``{% load static %}`` (instead of
|
|
|
|
``{% load staticfiles %}`` or ``{% load static from staticfiles %}``) and
|
|
|
|
not worry about whether or not the ``staticfiles`` app is installed.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
:mod:`django.contrib.syndication`
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Cache
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-08 06:05:01 +00:00
|
|
|
* The file-based cache backend now uses the highest pickling protocol.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
CSRF
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-07 13:18:06 +00:00
|
|
|
* The default :setting:`CSRF_FAILURE_VIEW`, ``views.csrf.csrf_failure()`` now
|
|
|
|
accepts an optional ``template_name`` parameter, defaulting to
|
|
|
|
``'403_csrf.html'``, to control the template used to render the page.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
Database backends
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Email
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
File Storage
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
File Uploads
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Forms
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-07 11:24:38 +00:00
|
|
|
* Form and widget ``Media`` is now served using
|
|
|
|
:mod:`django.contrib.staticfiles` if installed.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
Generic Views
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2016-01-09 11:40:08 +00:00
|
|
|
* The :class:`~django.views.generic.base.View` class can now be imported from
|
|
|
|
``django.views``.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
Internationalization
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Management Commands
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2016-01-12 01:59:34 +00:00
|
|
|
* The new :option:`check --fail-level` option allows specifying the message
|
|
|
|
level that will cause the command to exit with a non-zero status.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2016-01-12 01:59:34 +00:00
|
|
|
* The new :option:`makemigrations --check` option makes the command exit
|
|
|
|
with a non-zero status when model changes without migrations are detected.
|
2015-10-21 00:39:48 +00:00
|
|
|
|
2015-11-07 13:43:06 +00:00
|
|
|
* :djadmin:`makemigrations` now displays the path to the migration files that
|
|
|
|
it generates.
|
|
|
|
|
2016-01-12 01:59:34 +00:00
|
|
|
* The :option:`shell --interface` option now accepts ``python`` to force use of
|
|
|
|
the "plain" Python interpreter.
|
2015-12-13 19:33:39 +00:00
|
|
|
|
2016-01-12 01:59:34 +00:00
|
|
|
* The new :option:`shell --command` option lets you run a command as Django and
|
|
|
|
exit, instead of opening the interactive shell.
|
2015-11-07 11:07:28 +00:00
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
Migrations
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-16 21:41:46 +00:00
|
|
|
* Added support for serialization of ``enum.Enum`` objects.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2016-01-09 08:12:46 +00:00
|
|
|
* Added the ``elidable`` argument to the
|
|
|
|
:class:`~django.db.migrations.operations.RunSQL` and
|
|
|
|
:class:`~django.db.migrations.operations.RunPython` operations to allow them
|
|
|
|
to be removed when squashing migrations.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
Models
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-01 18:57:58 +00:00
|
|
|
* Reverse foreign keys from proxy models are now propagated to their
|
|
|
|
concrete class. The reverse relation attached by a
|
|
|
|
:class:`~django.db.models.ForeignKey` pointing to a proxy model is now
|
|
|
|
accessible as a descriptor on the proxied model class and may be referenced in
|
|
|
|
queryset filtering.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-13 07:56:10 +00:00
|
|
|
* The new :meth:`Field.rel_db_type() <django.db.models.Field.rel_db_type>`
|
|
|
|
method returns the database column data type for fields such as ``ForeignKey``
|
|
|
|
and ``OneToOneField`` that point to another field.
|
|
|
|
|
2015-10-31 10:01:08 +00:00
|
|
|
* The :attr:`~django.db.models.Func.arity` class attribute is added to
|
|
|
|
:class:`~django.db.models.Func`. This attribute can be used to set the number
|
|
|
|
of arguments the function accepts.
|
|
|
|
|
2015-07-02 08:43:15 +00:00
|
|
|
* Added :class:`~django.db.models.BigAutoField` which acts much like an
|
|
|
|
:class:`~django.db.models.AutoField` except that it is guaranteed
|
|
|
|
to fit numbers from ``1`` to ``9223372036854775807``.
|
|
|
|
|
2015-10-30 06:24:46 +00:00
|
|
|
* :meth:`QuerySet.in_bulk() <django.db.models.query.QuerySet.in_bulk>`
|
|
|
|
may be called without any arguments to return all objects in the queryset.
|
|
|
|
|
2015-09-29 17:52:26 +00:00
|
|
|
* :attr:`~django.db.models.ForeignKey.related_query_name` now supports
|
|
|
|
app label and class interpolation using the ``'%(app_label)s'`` and
|
|
|
|
``'%(class)s'`` strings.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
Requests and Responses
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-02 14:44:35 +00:00
|
|
|
* Added ``request.user`` to the debug view.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-20 21:23:58 +00:00
|
|
|
* Added :class:`~django.http.HttpResponse` methods
|
|
|
|
:meth:`~django.http.HttpResponse.readable()` and
|
|
|
|
:meth:`~django.http.HttpResponse.seekable()` to make an instance a
|
|
|
|
stream-like object and allow wrapping it with :py:class:`io.TextIOWrapper`.
|
|
|
|
|
2015-09-26 18:15:26 +00:00
|
|
|
Serialization
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~~~~
|
2015-09-26 18:15:26 +00:00
|
|
|
|
|
|
|
* The ``django.core.serializers.json.DjangoJSONEncoder`` now knows how to
|
|
|
|
serialize lazy strings, typically used for translatable content.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
Signals
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Templates
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-08 09:06:07 +00:00
|
|
|
* Added the ``autoescape`` option to the
|
|
|
|
:class:`~django.template.backends.django.DjangoTemplates` backend and the
|
|
|
|
:class:`~django.template.Engine` class.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2016-01-22 03:50:06 +00:00
|
|
|
* Added the ``is`` comparison operator to the :ttag:`if` tag.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
Tests
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
URLs
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-23 19:02:34 +00:00
|
|
|
* An addition in :func:`django.setup()` allows URL resolving that happens
|
|
|
|
outside of the request/response cycle (e.g. in management commands and
|
|
|
|
standalone scripts) to take :setting:`FORCE_SCRIPT_NAME` into account when it
|
|
|
|
is set.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
Validators
|
2016-01-03 10:56:22 +00:00
|
|
|
~~~~~~~~~~
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-07 10:08:16 +00:00
|
|
|
* :class:`~django.core.validators.URLValidator` now limits the length of
|
|
|
|
domain name labels to 63 characters and the total length of domain
|
|
|
|
names to 253 characters per :rfc:`1034`.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
Backwards incompatible changes in 1.10
|
|
|
|
======================================
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
In addition to the changes outlined in this section, be sure to review the
|
|
|
|
:ref:`removed-features-1.10` for the features that have reached the end of
|
|
|
|
their deprecation cycle and therefore been removed. If you haven't updated
|
|
|
|
your code within the deprecation timeline for a given feature, its removal
|
|
|
|
may appear as a backwards incompatible change.
|
|
|
|
|
|
|
|
Database backend API
|
2016-01-03 10:56:22 +00:00
|
|
|
--------------------
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* ...
|
|
|
|
|
2015-10-10 01:03:04 +00:00
|
|
|
``select_related()`` prohibits non-relational fields for nested relations
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Django 1.8 added validation for non-relational fields in ``select_related()``::
|
|
|
|
|
|
|
|
>>> Book.objects.select_related('title')
|
|
|
|
Traceback (most recent call last):
|
|
|
|
...
|
|
|
|
FieldError: Non-relational field given in select_related: 'title'
|
|
|
|
|
|
|
|
But it didn't prohibit nested non-relation fields as it does now::
|
|
|
|
|
|
|
|
>>> Book.objects.select_related('author__name')
|
|
|
|
Traceback (most recent call last):
|
|
|
|
...
|
|
|
|
FieldError: Non-relational field given in select_related: 'name'
|
|
|
|
|
2015-10-07 19:29:20 +00:00
|
|
|
``_meta.get_fields()`` returns consistent reverse fields for proxy models
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Before Django 1.10, the :meth:`~django.db.models.options.Options.get_fields`
|
|
|
|
method returned different reverse fields when called on a proxy model compared
|
|
|
|
to its proxied concrete class. This inconsistency was fixed by returning the
|
|
|
|
full set of fields pointing to a concrete class or one of its proxies in both
|
|
|
|
cases.
|
|
|
|
|
2015-12-29 19:52:48 +00:00
|
|
|
:attr:`AbstractUser.username <django.contrib.auth.models.User.username>` ``max_length`` increased to 150
|
2015-10-28 19:59:17 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
A migration for :attr:`django.contrib.auth.models.User.username` is included.
|
|
|
|
If you have a custom user model inheriting from ``AbstractUser``, you'll need
|
|
|
|
to generate and apply a database migration for your user model.
|
|
|
|
|
2015-12-29 19:52:48 +00:00
|
|
|
We considered an increase to 254 characters to more easily allow the use of
|
|
|
|
email addresses (which are limited to 254 characters) as usernames but rejected
|
|
|
|
it due to a MySQL limitation. When using the ``utf8mb4`` encoding (recommended
|
|
|
|
for proper Unicode support), MySQL can only create unique indexes with 191
|
|
|
|
characters by default. Therefore, if you need a longer length, please use a
|
|
|
|
custom user model.
|
|
|
|
|
2015-10-28 19:59:17 +00:00
|
|
|
If you want to preserve the 30 character limit for usernames, use a custom form
|
|
|
|
when creating a user or changing usernames::
|
|
|
|
|
|
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
|
|
|
|
|
|
class MyUserCreationForm(UserCreationForm):
|
|
|
|
username = forms.CharField(
|
|
|
|
max_length=30,
|
|
|
|
help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
|
|
|
|
)
|
|
|
|
|
|
|
|
If you wish to keep this restriction in the admin, set ``UserAdmin.add_form``
|
|
|
|
to use this form::
|
|
|
|
|
2015-12-08 19:40:55 +00:00
|
|
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
2015-10-28 19:59:17 +00:00
|
|
|
from django.contrib.auth.models import User
|
|
|
|
|
2015-12-08 19:40:55 +00:00
|
|
|
class UserAdmin(BaseUserAdmin):
|
2015-10-28 19:59:17 +00:00
|
|
|
add_form = MyUserCreationForm
|
|
|
|
|
|
|
|
admin.site.unregister(User)
|
2015-12-08 19:40:55 +00:00
|
|
|
admin.site.register(User, UserAdmin)
|
2015-10-28 19:59:17 +00:00
|
|
|
|
2015-12-23 16:47:40 +00:00
|
|
|
Dropped support for PostgreSQL 9.1
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Upstream support for PostgreSQL 9.1 ends in September 2016. As a consequence,
|
|
|
|
Django 1.10 sets PostgreSQL 9.2 as the minimum version it officially supports.
|
|
|
|
|
2015-11-06 16:19:41 +00:00
|
|
|
``runserver`` output goes through logging
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Request and response handling of the ``runserver`` command is sent to the
|
|
|
|
:ref:`django-server-logger` logger instead of to ``sys.stderr``. If you
|
|
|
|
disable Django's logging configuration or override it with your own, you'll
|
|
|
|
need to add the appropriate logging configuration if you want to see that
|
|
|
|
output::
|
|
|
|
|
|
|
|
'formatters': {
|
|
|
|
'django.server': {
|
|
|
|
'()': 'django.utils.log.ServerFormatter',
|
|
|
|
'format': '[%(server_time)s] %(message)s',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'handlers': {
|
|
|
|
'django.server': {
|
|
|
|
'level': 'INFO',
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'formatter': 'django.server',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'loggers': {
|
|
|
|
'django.server': {
|
|
|
|
'handlers': ['django.server'],
|
|
|
|
'level': 'INFO',
|
|
|
|
'propagate': False,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
Miscellaneous
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
2015-10-10 01:06:00 +00:00
|
|
|
* The ``repr()`` of a ``QuerySet`` is wrapped in ``<QuerySet >`` to
|
2015-10-05 23:07:34 +00:00
|
|
|
disambiguate it from a plain list when debugging.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-31 20:28:46 +00:00
|
|
|
* Support for SpatiaLite < 3.0 and GEOS < 3.3 is dropped.
|
2015-10-30 19:04:00 +00:00
|
|
|
|
2015-11-17 16:51:26 +00:00
|
|
|
* ``utils.version.get_version()`` returns :pep:`440` compliant release
|
|
|
|
candidate versions (e.g. '1.10rc1' instead of '1.10c1').
|
|
|
|
|
2015-12-11 17:43:02 +00:00
|
|
|
* The ``LOGOUT_URL`` setting is removed as Django hasn't made use of it
|
|
|
|
since pre-1.0. If you use it in your project, you can add it to your
|
2015-12-11 17:54:04 +00:00
|
|
|
project's settings. The default value was ``'/accounts/logout/'``.
|
2015-12-11 17:43:02 +00:00
|
|
|
|
2015-12-12 15:00:46 +00:00
|
|
|
* The ``add_postgis_srs()`` backwards compatibility alias for
|
|
|
|
``django.contrib.gis.utils.add_srs_entry()`` is removed.
|
|
|
|
|
2015-11-11 19:17:32 +00:00
|
|
|
* Objects with a ``close()`` method such as files and generators passed to
|
|
|
|
:class:`~django.http.HttpResponse` are now closed immediately instead of when
|
|
|
|
the WSGI server calls ``close()`` on the response.
|
|
|
|
|
2015-12-09 12:18:44 +00:00
|
|
|
* A redundant ``transaction.atomic()`` call in ``QuerySet.update_or_create()``
|
|
|
|
is removed. This may affect query counts tested by
|
|
|
|
``TransactionTestCase.assertNumQueries()``.
|
|
|
|
|
2015-12-21 19:26:42 +00:00
|
|
|
* Support for ``skip_validation`` in ``BaseCommand.execute(**options)`` is
|
|
|
|
removed. Use ``skip_checks`` (added in Django 1.7) instead.
|
|
|
|
|
2016-01-02 19:11:18 +00:00
|
|
|
* :djadmin:`loaddata` now raises a ``CommandError`` instead of showing a
|
|
|
|
warning when the specified fixture file is not found.
|
|
|
|
|
2015-12-26 18:51:22 +00:00
|
|
|
* Instead of directly accessing the ``LogEntry.change_message`` attribute, it's
|
|
|
|
now better to call the ``LogEntry.get_change_message()`` method which will
|
|
|
|
provide the message in the current language.
|
|
|
|
|
2015-11-07 16:24:07 +00:00
|
|
|
* The default error views now raise ``TemplateDoesNotExist`` if a nonexistent
|
|
|
|
``template_name`` is specified.
|
|
|
|
|
2016-01-25 04:15:42 +00:00
|
|
|
* The unused ``choices`` keyword argument of the ``Select`` and
|
|
|
|
``SelectMultiple`` widgets' ``render()`` method is removed. The ``choices``
|
|
|
|
argument of the ``render_options()`` method is also removed, making
|
|
|
|
``selected_choices`` the first argument.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
.. _deprecated-features-1.10:
|
|
|
|
|
|
|
|
Features deprecated in 1.10
|
|
|
|
===========================
|
|
|
|
|
2015-10-08 21:17:10 +00:00
|
|
|
Direct assignment to a reverse foreign key or many-to-many relation
|
2016-01-03 10:56:22 +00:00
|
|
|
-------------------------------------------------------------------
|
2015-10-08 21:17:10 +00:00
|
|
|
|
|
|
|
Instead of assigning related objects using direct assignment::
|
|
|
|
|
|
|
|
>>> new_list = [obj1, obj2, obj3]
|
|
|
|
>>> e.related_set = new_list
|
|
|
|
|
|
|
|
Use the :meth:`~django.db.models.fields.related.RelatedManager.set` method
|
|
|
|
added in Django 1.9::
|
|
|
|
|
|
|
|
>>> e.related_set.set([obj1, obj2, obj3])
|
|
|
|
|
|
|
|
This prevents confusion about an assignment resulting in an implicit save.
|
|
|
|
|
2015-11-04 18:56:14 +00:00
|
|
|
:mod:`django.contrib.gis`
|
2016-01-03 10:56:22 +00:00
|
|
|
-------------------------
|
2015-11-04 18:56:14 +00:00
|
|
|
|
|
|
|
* The ``get_srid()`` and ``set_srid()`` methods of
|
|
|
|
:class:`~django.contrib.gis.geos.GEOSGeometry` are deprecated in favor
|
|
|
|
of the :attr:`~django.contrib.gis.geos.GEOSGeometry.srid` property.
|
|
|
|
|
2015-11-05 03:45:42 +00:00
|
|
|
* The ``get_x()``, ``set_x()``, ``get_y()``, ``set_y()``, ``get_z()``, and
|
|
|
|
``set_z()`` methods of :class:`~django.contrib.gis.geos.Point` are deprecated
|
|
|
|
in favor of the ``x``, ``y``, and ``z`` properties.
|
|
|
|
|
2015-11-05 05:37:51 +00:00
|
|
|
* The ``get_coords()`` and ``set_coords()`` methods of
|
|
|
|
:class:`~django.contrib.gis.geos.Point` are deprecated in favor of the
|
|
|
|
``tuple`` property.
|
|
|
|
|
2015-11-25 18:59:57 +00:00
|
|
|
* The ``cascaded_union`` property of
|
|
|
|
:class:`~django.contrib.gis.geos.MultiPolygon` is deprecated in favor of the
|
|
|
|
:attr:`~django.contrib.gis.geos.GEOSGeometry.unary_union` property.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
Miscellaneous
|
2016-01-03 10:56:22 +00:00
|
|
|
-------------
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-10-21 00:39:48 +00:00
|
|
|
* The ``makemigrations --exit`` option is deprecated in favor of the
|
2016-01-12 01:59:34 +00:00
|
|
|
:option:`makemigrations --check` option.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
2015-11-07 13:30:20 +00:00
|
|
|
* ``django.utils.functional.allow_lazy()`` is deprecated in favor of the new
|
|
|
|
:func:`~django.utils.functional.keep_lazy` function which can be used with a
|
|
|
|
more natural decorator syntax.
|
|
|
|
|
2015-12-13 19:33:39 +00:00
|
|
|
* The ``shell --plain`` option is deprecated in favor of ``-i python`` or
|
|
|
|
``--interface python``.
|
|
|
|
|
2015-12-30 15:51:16 +00:00
|
|
|
* Importing from the ``django.core.urlresolvers`` module is deprecated in
|
|
|
|
favor of its new location, :mod:`django.urls`.
|
|
|
|
|
2015-09-20 00:34:58 +00:00
|
|
|
.. _removed-features-1.10:
|
|
|
|
|
|
|
|
Features removed in 1.10
|
|
|
|
========================
|
|
|
|
|
|
|
|
These features have reached the end of their deprecation cycle and so have been
|
|
|
|
removed in Django 1.10 (please see the :ref:`deprecation timeline
|
|
|
|
<deprecation-removed-in-1.10>` for more details):
|
|
|
|
|
|
|
|
* Support for calling a ``SQLCompiler`` directly as an alias for calling its
|
|
|
|
``quote_name_unless_alias`` method is removed.
|
|
|
|
|
|
|
|
* The ``cycle`` and ``firstof`` template tags are removed from the ``future``
|
|
|
|
template tag library.
|
|
|
|
|
|
|
|
* ``django.conf.urls.patterns()`` is removed.
|
|
|
|
|
|
|
|
* Support for the ``prefix`` argument to
|
|
|
|
``django.conf.urls.i18n.i18n_patterns()`` is removed.
|
|
|
|
|
|
|
|
* ``SimpleTestCase.urls`` is removed.
|
|
|
|
|
|
|
|
* Using an incorrect count of unpacked values in the ``for`` template tag
|
|
|
|
raises an exception rather than failing silently.
|
|
|
|
|
2015-12-30 15:51:16 +00:00
|
|
|
* The ability to :func:`~django.urls.reverse` URLs using a dotted Python path
|
|
|
|
is removed.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* Support for ``optparse`` is dropped for custom management commands.
|
|
|
|
|
|
|
|
* The class ``django.core.management.NoArgsCommand`` is removed.
|
|
|
|
|
|
|
|
* ``django.core.context_processors`` module is removed.
|
|
|
|
|
|
|
|
* ``django.db.models.sql.aggregates`` module is removed.
|
|
|
|
|
|
|
|
* ``django.contrib.gis.db.models.sql.aggregates`` module is removed.
|
|
|
|
|
|
|
|
* The following methods and properties of ``django.db.sql.query.Query`` are
|
|
|
|
removed:
|
|
|
|
|
|
|
|
* Properties: ``aggregates`` and ``aggregate_select``
|
|
|
|
* Methods: ``add_aggregate``, ``set_aggregate_mask``, and
|
|
|
|
``append_aggregate_mask``.
|
|
|
|
|
|
|
|
* ``django.template.resolve_variable`` is removed.
|
|
|
|
|
|
|
|
* The following private APIs are removed from
|
|
|
|
:class:`django.db.models.options.Options` (``Model._meta``):
|
|
|
|
|
|
|
|
* ``get_field_by_name()``
|
|
|
|
* ``get_all_field_names()``
|
|
|
|
* ``get_fields_with_model()``
|
|
|
|
* ``get_concrete_fields_with_model()``
|
|
|
|
* ``get_m2m_with_model()``
|
|
|
|
* ``get_all_related_objects()``
|
|
|
|
* ``get_all_related_objects_with_model()``
|
|
|
|
* ``get_all_related_many_to_many_objects()``
|
|
|
|
* ``get_all_related_m2m_objects_with_model()``
|
|
|
|
|
|
|
|
* The ``error_message`` argument of ``django.forms.RegexField`` is removed.
|
|
|
|
|
|
|
|
* The ``unordered_list`` filter no longer supports old style lists.
|
|
|
|
|
|
|
|
* Support for string ``view`` arguments to ``url()`` is removed.
|
|
|
|
|
|
|
|
* The backward compatible shim to rename ``django.forms.Form._has_changed()``
|
|
|
|
to ``has_changed()`` is removed.
|
|
|
|
|
|
|
|
* The ``removetags`` template filter is removed.
|
|
|
|
|
|
|
|
* The ``remove_tags()`` and ``strip_entities()`` functions in
|
|
|
|
``django.utils.html`` is removed.
|
|
|
|
|
|
|
|
* The ``is_admin_site`` argument to
|
|
|
|
``django.contrib.auth.views.password_reset()`` is removed.
|
|
|
|
|
|
|
|
* ``django.db.models.field.subclassing.SubfieldBase`` is removed.
|
|
|
|
|
|
|
|
* ``django.utils.checksums`` is removed.
|
|
|
|
|
|
|
|
* The ``original_content_type_id`` attribute on
|
|
|
|
``django.contrib.admin.helpers.InlineAdminForm`` is removed.
|
|
|
|
|
|
|
|
* The backwards compatibility shim to allow ``FormMixin.get_form()`` to be
|
|
|
|
defined with no default value for its ``form_class`` argument is removed.
|
|
|
|
|
|
|
|
* The following settings are removed:
|
|
|
|
|
|
|
|
* ``ALLOWED_INCLUDE_ROOTS``
|
|
|
|
* ``TEMPLATE_CONTEXT_PROCESSORS``
|
|
|
|
* ``TEMPLATE_DEBUG``
|
|
|
|
* ``TEMPLATE_DIRS``
|
|
|
|
* ``TEMPLATE_LOADERS``
|
|
|
|
* ``TEMPLATE_STRING_IF_INVALID``
|
|
|
|
|
|
|
|
* The backwards compatibility alias ``django.template.loader.BaseLoader`` is
|
|
|
|
removed.
|
|
|
|
|
|
|
|
* Django template objects returned by
|
|
|
|
:func:`~django.template.loader.get_template` and
|
|
|
|
:func:`~django.template.loader.select_template` no longer accept a
|
|
|
|
:class:`~django.template.Context` in their
|
|
|
|
:meth:`~django.template.backends.base.Template.render()` method.
|
|
|
|
|
|
|
|
* :doc:`Template response APIs </ref/template-response>` enforce the use of
|
|
|
|
:class:`dict` and backend-dependent template objects instead of
|
|
|
|
:class:`~django.template.Context` and :class:`~django.template.Template`
|
|
|
|
respectively.
|
|
|
|
|
|
|
|
* The ``current_app`` parameter for the following function and classes is
|
|
|
|
removed:
|
|
|
|
|
|
|
|
* ``django.shortcuts.render()``
|
|
|
|
* ``django.template.Context()``
|
|
|
|
* ``django.template.RequestContext()``
|
|
|
|
* ``django.template.response.TemplateResponse()``
|
|
|
|
|
|
|
|
* The ``dictionary`` and ``context_instance`` parameters for the following
|
|
|
|
functions are removed:
|
|
|
|
|
|
|
|
* ``django.shortcuts.render()``
|
|
|
|
* ``django.shortcuts.render_to_response()``
|
|
|
|
* ``django.template.loader.render_to_string()``
|
|
|
|
|
|
|
|
* The ``dirs`` parameter for the following functions is removed:
|
|
|
|
|
|
|
|
* ``django.template.loader.get_template()``
|
|
|
|
* ``django.template.loader.select_template()``
|
|
|
|
* ``django.shortcuts.render()``
|
|
|
|
* ``django.shortcuts.render_to_response()``
|
|
|
|
|
|
|
|
* Session verification is enabled regardless of whether or not
|
|
|
|
``'django.contrib.auth.middleware.SessionAuthenticationMiddleware'`` is in
|
2015-09-03 00:50:34 +00:00
|
|
|
``MIDDLEWARE_CLASSES``. ``SessionAuthenticationMiddleware`` no longer has
|
|
|
|
any purpose and can be removed from ``MIDDLEWARE_CLASSES``. It's kept as
|
|
|
|
a stub until Django 2.0 as a courtesy for users who don't read this note.
|
2015-09-20 00:34:58 +00:00
|
|
|
|
|
|
|
* Private attribute ``django.db.models.Field.related`` is removed.
|
|
|
|
|
|
|
|
* The ``--list`` option of the ``migrate`` management command is removed.
|
|
|
|
|
|
|
|
* The ``ssi`` template tag is removed.
|
|
|
|
|
|
|
|
* Support for the ``=`` comparison operator in the ``if`` template tag is
|
|
|
|
removed.
|
|
|
|
|
|
|
|
* The backwards compatibility shims to allow ``Storage.get_available_name()``
|
|
|
|
and ``Storage.save()`` to be defined without a ``max_length`` argument are
|
|
|
|
removed.
|
|
|
|
|
|
|
|
* Support for the legacy ``%(<foo>)s`` syntax in ``ModelFormMixin.success_url``
|
|
|
|
is removed.
|
|
|
|
|
|
|
|
* ``GeoQuerySet`` aggregate methods ``collect()``, ``extent()``, ``extent3d()``,
|
|
|
|
``make_line()``, and ``unionagg()`` are removed.
|
|
|
|
|
|
|
|
* The ability to specify ``ContentType.name`` when creating a content type
|
|
|
|
instance is removed.
|
|
|
|
|
|
|
|
* Support for the old signature of ``allow_migrate`` is removed.
|
|
|
|
|
|
|
|
* Support for the syntax of ``{% cycle %}`` that uses comma-separated arguments
|
|
|
|
is removed.
|
|
|
|
|
|
|
|
* The warning that :class:`~django.core.signing.Signer` issued when given an
|
|
|
|
invalid separator is now a ``ValueError``.
|