2016-05-20 10:28:24 +08:00
|
|
|
|
=============================================
|
|
|
|
|
Django 1.11 release notes - UNDER DEVELOPMENT
|
|
|
|
|
=============================================
|
|
|
|
|
|
|
|
|
|
Welcome to Django 1.11!
|
|
|
|
|
|
2016-06-02 23:41:49 +08:00
|
|
|
|
These release notes cover the :ref:`new features <whats-new-1.11>`, as well as
|
|
|
|
|
some :ref:`backwards incompatible changes <backwards-incompatible-1.11>` you'll
|
|
|
|
|
want to be aware of when upgrading from Django 1.10 or older versions. We've
|
|
|
|
|
:ref:`begun the deprecation process for some features
|
|
|
|
|
<deprecated-features-1.11>`.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
2016-06-06 18:46:20 +08:00
|
|
|
|
See the :doc:`/howto/upgrade-version` guide if you're updating an existing
|
|
|
|
|
project.
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
Django 1.11 is designated as a :term:`long-term support release`. It will
|
|
|
|
|
receive security updates for at least three years after its release. Support
|
|
|
|
|
for the previous LTS, Django 1.8, will end 6 months after the release date of
|
|
|
|
|
Django 1.11.
|
|
|
|
|
|
|
|
|
|
Python compatibility
|
|
|
|
|
====================
|
|
|
|
|
|
|
|
|
|
Like Django 1.10, Django 1.11 requires Python 2.7, 3.4, or 3.5. We **highly
|
|
|
|
|
recommend** and only officially support the latest release of each series.
|
|
|
|
|
|
|
|
|
|
The Django 1.11.x series is the last to support Python 2. The next major
|
|
|
|
|
release, Django 2.0, will only support Python 3.5+.
|
|
|
|
|
|
2016-06-02 03:17:25 +08:00
|
|
|
|
Deprecating warnings are no longer loud by default
|
|
|
|
|
==================================================
|
|
|
|
|
|
|
|
|
|
Unlike older versions of Django, Django's own deprecation warnings are no
|
|
|
|
|
longer displayed by default. This is consistent with Python's default behavior.
|
|
|
|
|
|
|
|
|
|
This change allows third-party apps to support both Django 1.11 LTS and Django
|
|
|
|
|
1.8 LTS without having to add code to avoid deprecation warnings.
|
|
|
|
|
|
|
|
|
|
Following the release of Django 2.0, we suggest that third-party app authors
|
|
|
|
|
drop support for all versions of Django prior to 1.11. At that time, you should
|
|
|
|
|
be able run your package's tests using ``python -Wd`` so that deprecation
|
|
|
|
|
warnings do appear. After making the deprecation warning fixes, your app should
|
|
|
|
|
be compatible with Django 2.0.
|
|
|
|
|
|
2016-06-02 23:41:49 +08:00
|
|
|
|
.. _whats-new-1.11:
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
What's new in Django 1.11
|
|
|
|
|
=========================
|
|
|
|
|
|
|
|
|
|
Minor features
|
|
|
|
|
--------------
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.admin`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2016-05-06 01:52:54 +08:00
|
|
|
|
* :attr:`.ModelAdmin.date_hierarchy` can now reference fields across relations.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.admindocs`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.auth`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2016-05-20 21:18:55 +08:00
|
|
|
|
* The default iteration count for the PBKDF2 password hasher is increased by
|
|
|
|
|
20%.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
2016-05-15 23:28:00 +08:00
|
|
|
|
* The :class:`~django.contrib.auth.views.LoginView` and
|
|
|
|
|
:class:`~django.contrib.auth.views.LogoutView` class-based views supersede the
|
|
|
|
|
deprecated ``login()`` and ``logout()`` function-based views.
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
:mod:`django.contrib.contenttypes`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.gis`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2016-06-10 14:50:07 +08:00
|
|
|
|
* The new :meth:`.GEOSGeometry.from_gml` and :meth:`.OGRGeometry.from_gml`
|
|
|
|
|
methods allow creating geometries from GML.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.messages`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.postgres`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2016-05-15 17:53:16 +08:00
|
|
|
|
* The new ``distinct`` argument for
|
|
|
|
|
:class:`~django.contrib.postgres.aggregates.StringAgg` determines if
|
|
|
|
|
concatenated values will be distinct.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.redirects`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.sessions`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.sitemaps`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.sites`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.staticfiles`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
:mod:`django.contrib.syndication`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
Cache
|
|
|
|
|
~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
CSRF
|
|
|
|
|
~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
Database backends
|
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
Email
|
|
|
|
|
~~~~~
|
|
|
|
|
|
2016-06-03 07:41:13 +08:00
|
|
|
|
* Added the :setting:`EMAIL_USE_LOCALTIME` setting to allow sending SMTP date
|
|
|
|
|
headers in the local time zone rather than in UTC.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
File Storage
|
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
2016-05-23 00:43:56 +08:00
|
|
|
|
* To make it wrappable by :class:`io.TextIOWrapper`,
|
|
|
|
|
:class:`~django.core.files.File` now has the ``readable()``, ``writable()``,
|
|
|
|
|
and ``seekable()`` methods.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
File Uploads
|
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
Forms
|
|
|
|
|
~~~~~
|
|
|
|
|
|
2016-05-18 22:30:42 +08:00
|
|
|
|
* The new :attr:`CharField.empty_value <django.forms.CharField.empty_value>`
|
|
|
|
|
attribute allows specifying the Python value to use to represent "empty".
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
Generic Views
|
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
Internationalization
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2016-06-03 03:13:47 +08:00
|
|
|
|
* Number formatting and the :setting:`NUMBER_GROUPING` setting support
|
|
|
|
|
non-uniform digit grouping.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
Management Commands
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2016-05-17 14:52:01 +08:00
|
|
|
|
* The new :option:`loaddata --exclude` option allows excluding models and apps
|
|
|
|
|
while loading data from fixtures.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
Migrations
|
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
Models
|
|
|
|
|
~~~~~~
|
|
|
|
|
|
2016-05-26 04:33:35 +08:00
|
|
|
|
* Added support for callable values in the ``defaults`` argument of
|
|
|
|
|
:meth:`QuerySet.update_or_create()
|
|
|
|
|
<django.db.models.query.QuerySet.update_or_create>` and
|
|
|
|
|
:meth:`~django.db.models.query.QuerySet.get_or_create`.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
Requests and Responses
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2016-06-04 06:50:38 +08:00
|
|
|
|
* Added :meth:`QueryDict.fromkeys() <django.http.QueryDict.fromkeys>`.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
2016-06-18 16:51:38 +08:00
|
|
|
|
* :class:`~django.middleware.common.CommonMiddleware` now sets the
|
|
|
|
|
``Content-Length`` response header for non-streaming responses.
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
Serialization
|
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
2016-06-08 09:22:30 +08:00
|
|
|
|
* The new ``django.core.serializers.base.Serializer.stream_class`` attribute
|
|
|
|
|
allows subclasses to customize the default stream.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
2016-06-28 19:48:19 +08:00
|
|
|
|
* The encoder used by the :ref:`JSON serializer <serialization-formats-json>`
|
|
|
|
|
can now be customized by passing a ``cls`` keyword argument to the
|
|
|
|
|
``serializers.serialize()`` function.
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
Signals
|
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
Templates
|
|
|
|
|
~~~~~~~~~
|
|
|
|
|
|
2016-06-03 05:11:43 +08:00
|
|
|
|
* :meth:`~django.utils.safestring.mark_safe` can now be used as a decorator.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
|
|
|
|
Tests
|
|
|
|
|
~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
URLs
|
|
|
|
|
~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
Validators
|
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
2016-06-02 23:41:49 +08:00
|
|
|
|
.. _backwards-incompatible-1.11:
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
Backwards incompatible changes in 1.11
|
|
|
|
|
======================================
|
|
|
|
|
|
2016-06-14 22:18:33 +08:00
|
|
|
|
:mod:`django.contrib.gis`
|
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
|
|
* To simplify the codebase and because it's easier to install than when
|
|
|
|
|
``contrib.gis`` was first released, :ref:`gdalbuild` is now a required
|
|
|
|
|
dependency for GeoDjango. In older versions, it's only required for SQLite.
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
Database backend API
|
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
2016-05-29 08:11:42 +08:00
|
|
|
|
Dropped support for PostgreSQL 9.2 and PostGIS 2.0
|
2016-06-22 23:16:18 +08:00
|
|
|
|
--------------------------------------------------
|
2016-05-29 08:11:42 +08:00
|
|
|
|
|
|
|
|
|
Upstream support for PostgreSQL 9.2 ends in September 2017. As a consequence,
|
|
|
|
|
Django 1.11 sets PostgreSQL 9.3 as the minimum version it officially supports.
|
|
|
|
|
|
|
|
|
|
Support for PostGIS 2.0 is also removed as PostgreSQL 9.2 is the last version
|
|
|
|
|
to support it.
|
|
|
|
|
|
2016-06-24 00:04:05 +08:00
|
|
|
|
``LiveServerTestCase`` binds to port zero
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
|
|
|
|
|
Rather than taking a port range and iterating to find a free port,
|
|
|
|
|
``LiveServerTestCase`` binds to port zero and relies on the operating system
|
|
|
|
|
to assign a free port. The ``DJANGO_LIVE_TEST_SERVER_ADDRESS`` environment
|
|
|
|
|
variable is no longer used, and as it's also no longer used, the
|
|
|
|
|
``manage.py test --liveserver`` option is removed.
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
Miscellaneous
|
|
|
|
|
-------------
|
|
|
|
|
|
2016-05-25 00:50:20 +08:00
|
|
|
|
* If no items in the feed have a ``pubdate`` or ``updateddate`` attribute,
|
|
|
|
|
:meth:`SyndicationFeed.latest_post_date()
|
|
|
|
|
<django.utils.feedgenerator.SyndicationFeed.latest_post_date>` now returns
|
|
|
|
|
the current UTC date/time, instead of a datetime without any timezone
|
|
|
|
|
information.
|
2016-05-20 10:28:24 +08:00
|
|
|
|
|
2016-05-31 23:31:51 +08:00
|
|
|
|
* Support for SpatiaLite < 4.0 is dropped.
|
|
|
|
|
|
2016-06-23 00:10:42 +08:00
|
|
|
|
* CSRF failures are logged to the ``django.security.csrf`` logger instead of
|
2016-06-03 08:24:48 +08:00
|
|
|
|
``django.request``.
|
|
|
|
|
|
2016-06-04 06:02:38 +08:00
|
|
|
|
* :setting:`ALLOWED_HOSTS` validation is no longer disabled when running tests.
|
|
|
|
|
If your application includes tests with custom host names, you must include
|
|
|
|
|
those host names in :setting:`ALLOWED_HOSTS`. See
|
|
|
|
|
:ref:`topics-testing-advanced-multiple-hosts`.
|
|
|
|
|
|
2016-04-24 01:35:18 +08:00
|
|
|
|
* Using a foreign key's id (e.g. ``'field_id'``) in ``ModelAdmin.list_display``
|
2016-06-10 03:05:59 +08:00
|
|
|
|
displays the related object's ID. Remove the ``_id`` suffix if you want the
|
|
|
|
|
old behavior of the string representation of the object.
|
2016-04-24 01:35:18 +08:00
|
|
|
|
|
2016-05-18 22:30:42 +08:00
|
|
|
|
* In model forms, :class:`~django.db.models.CharField` with ``null=True`` now
|
|
|
|
|
saves ``NULL`` for blank values instead of empty strings.
|
|
|
|
|
|
|
|
|
|
* On Oracle, :meth:`Model.validate_unique()
|
|
|
|
|
<django.db.models.Model.validate_unique>` no longer checks empty strings for
|
|
|
|
|
uniqueness as the database interprets the value as ``NULL``.
|
|
|
|
|
|
2016-06-16 18:06:59 +08:00
|
|
|
|
* If you subclass :class:`.AbstractUser` and override ``clean()``, be sure it
|
|
|
|
|
calls ``super()``. :meth:`.BaseUserManager.normalize_email` is called in a
|
|
|
|
|
new :meth:`.AbstractUser.clean` method so that normalization is applied in
|
|
|
|
|
cases like model form validation.
|
|
|
|
|
|
2016-05-20 10:28:24 +08:00
|
|
|
|
.. _deprecated-features-1.11:
|
|
|
|
|
|
|
|
|
|
Features deprecated in 1.11
|
|
|
|
|
===========================
|
|
|
|
|
|
|
|
|
|
Miscellaneous
|
|
|
|
|
-------------
|
|
|
|
|
|
2016-05-15 23:28:00 +08:00
|
|
|
|
* ``contrib.auth``’s ``login()`` and ``logout()`` function-based views are
|
|
|
|
|
deprecated in favor of new class-based views
|
|
|
|
|
:class:`~django.contrib.auth.views.LoginView` and
|
|
|
|
|
:class:`~django.contrib.auth.views.LogoutView`.
|