2019-09-05 14:46:01 +02:00
|
|
|
============================================
|
|
|
|
Django 3.1 release notes - UNDER DEVELOPMENT
|
|
|
|
============================================
|
|
|
|
|
|
|
|
*Expected August 2020*
|
|
|
|
|
|
|
|
Welcome to Django 3.1!
|
|
|
|
|
|
|
|
These release notes cover the :ref:`new features <whats-new-3.1>`, as well as
|
|
|
|
some :ref:`backwards incompatible changes <backwards-incompatible-3.1>` you'll
|
|
|
|
want to be aware of when upgrading from Django 3.0 or earlier. We've
|
|
|
|
:ref:`dropped some features<removed-features-3.1>` that have reached the end of
|
|
|
|
their deprecation cycle, and we've :ref:`begun the deprecation process for
|
|
|
|
some features <deprecated-features-3.1>`.
|
|
|
|
|
|
|
|
See the :doc:`/howto/upgrade-version` guide if you're updating an existing
|
|
|
|
project.
|
|
|
|
|
|
|
|
Python compatibility
|
|
|
|
====================
|
|
|
|
|
|
|
|
Django 3.1 supports Python 3.6, 3.7, and 3.8. We **highly recommend** and only
|
|
|
|
officially support the latest release of each series.
|
|
|
|
|
|
|
|
.. _whats-new-3.1:
|
|
|
|
|
|
|
|
What's new in Django 3.1
|
|
|
|
========================
|
|
|
|
|
|
|
|
Minor features
|
|
|
|
--------------
|
|
|
|
|
|
|
|
:mod:`django.contrib.admin`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.admindocs`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.auth`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2019-09-12 11:46:37 +02:00
|
|
|
* The default iteration count for the PBKDF2 password hasher is increased from
|
|
|
|
180,000 to 216,000.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
2019-08-23 17:14:07 +02:00
|
|
|
* Added the :setting:`PASSWORD_RESET_TIMEOUT` setting to define the minimum
|
|
|
|
number of seconds a password reset link is valid for. This is encouraged
|
|
|
|
instead of deprecated ``PASSWORD_RESET_TIMEOUT_DAYS``, which will be removed
|
|
|
|
in Django 4.0.
|
|
|
|
|
2019-09-05 14:46:01 +02:00
|
|
|
:mod:`django.contrib.contenttypes`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.gis`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2019-10-17 14:02:37 +02:00
|
|
|
* :lookup:`relate` lookup is now supported on MariaDB.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
2019-10-17 10:17:42 +02:00
|
|
|
* Added the :attr:`.LinearRing.is_counterclockwise` property.
|
|
|
|
|
2019-09-05 14:46:01 +02:00
|
|
|
:mod:`django.contrib.messages`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.postgres`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
: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
|
|
|
|
~~~~~
|
|
|
|
|
2019-09-26 22:58:14 +02:00
|
|
|
* The :func:`~django.views.decorators.cache.cache_control` decorator and
|
|
|
|
:func:`~django.utils.cache.patch_cache_control` method now support multiple
|
|
|
|
field names in the ``no-cache`` directive for the ``Cache-Control`` header,
|
|
|
|
according to :rfc:`7234#section-5.2.2.2`.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
|
|
|
CSRF
|
|
|
|
~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Email
|
|
|
|
~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
File Storage
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
2019-10-21 18:03:48 +02:00
|
|
|
* ``FileSystemStorage.save()`` method now supports :class:`pathlib.Path`.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
|
|
|
File Uploads
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
|
|
|
|
Forms
|
|
|
|
~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Generic Views
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Internationalization
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Logging
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Management Commands
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Migrations
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
2019-03-28 21:47:05 +01:00
|
|
|
* Migrations are now loaded also from directories without ``__init__.py``
|
|
|
|
files.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
|
|
|
Models
|
|
|
|
~~~~~~
|
|
|
|
|
2019-10-01 00:12:19 +02:00
|
|
|
* The new :class:`~django.db.models.functions.ExtractIsoWeekDay` function
|
|
|
|
extracts ISO-8601 week days from :class:`~django.db.models.DateField` and
|
|
|
|
:class:`~django.db.models.DateTimeField`, and the new :lookup:`iso_week_day`
|
|
|
|
lookup allows querying by an ISO-8601 day of week.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
2019-10-21 18:34:19 +02:00
|
|
|
* :meth:`.QuerySet.explain` now supports:
|
|
|
|
|
|
|
|
* ``TREE`` format on MySQL 8.0.16+,
|
|
|
|
* ``analyze`` option on MySQL 8.0.18+ and MariaDB.
|
2019-10-21 18:32:56 +02:00
|
|
|
|
2019-09-20 23:04:34 +02:00
|
|
|
Pagination
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
2019-10-03 10:14:06 +02:00
|
|
|
* :class:`~django.core.paginator.Paginator` can now be iterated over to yield
|
|
|
|
its pages.
|
2019-09-20 23:04:34 +02:00
|
|
|
|
2019-09-05 14:46:01 +02:00
|
|
|
Requests and Responses
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Serialization
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Signals
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Templates
|
|
|
|
~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Tests
|
|
|
|
~~~~~
|
|
|
|
|
2016-10-26 23:10:17 +02:00
|
|
|
* :class:`~django.test.SimpleTestCase` now implements the ``debug()`` method to
|
|
|
|
allow running a test without collecting the result and catching exceptions.
|
|
|
|
This can be used to support running tests under a debugger.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
|
|
|
URLs
|
|
|
|
~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
2019-10-29 21:15:18 +01:00
|
|
|
Utilities
|
|
|
|
~~~~~~~~~
|
|
|
|
|
|
|
|
* :func:`~django.utils.encoding.filepath_to_uri` now supports
|
|
|
|
:class:`pathlib.Path`.
|
|
|
|
|
2019-09-05 14:46:01 +02:00
|
|
|
Validators
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
.. _backwards-incompatible-3.1:
|
|
|
|
|
|
|
|
Backwards incompatible changes in 3.1
|
|
|
|
=====================================
|
|
|
|
|
|
|
|
Database backend API
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
This section describes changes that may be needed in third-party database
|
|
|
|
backends.
|
|
|
|
|
2019-09-14 23:50:14 +02:00
|
|
|
* ``DatabaseOperations.fetch_returned_insert_columns()`` now requires an
|
|
|
|
additional ``returning_params`` argument.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
2019-10-16 12:58:05 +02:00
|
|
|
Dropped support for MariaDB 10.1
|
|
|
|
--------------------------------
|
|
|
|
|
|
|
|
Upstream support for MariaDB 10.1 ends in October 2020. Django 3.1 supports
|
|
|
|
MariaDB 10.2 and higher.
|
|
|
|
|
2019-09-05 14:46:01 +02:00
|
|
|
Miscellaneous
|
|
|
|
-------------
|
|
|
|
|
2019-09-11 23:12:35 +02:00
|
|
|
* The cache keys used by :ttag:`cache` and generated by
|
|
|
|
:func:`~django.core.cache.utils.make_template_fragment_key` are different
|
|
|
|
from the keys generated by older versions of Django. After upgrading to
|
|
|
|
Django 3.1, the first request to any previously cached template fragment will
|
|
|
|
be a cache miss.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
2019-07-18 08:13:01 +02:00
|
|
|
* The compatibility imports of ``django.core.exceptions.EmptyResultSet`` in
|
|
|
|
``django.db.models.query``, ``django.db.models.sql``, and
|
|
|
|
``django.db.models.sql.datastructures`` are removed.
|
|
|
|
|
|
|
|
* The compatibility import of ``django.core.exceptions.FieldDoesNotExist`` in
|
|
|
|
``django.db.models.fields`` is removed.
|
|
|
|
|
|
|
|
* The compatibility imports of ``django.forms.utils.pretty_name()`` and
|
|
|
|
``django.forms.boundfield.BoundField`` in ``django.forms.forms`` are removed.
|
|
|
|
|
|
|
|
* The compatibility imports of ``Context``, ``ContextPopException``, and
|
|
|
|
``RequestContext`` in ``django.template.base`` are removed.
|
|
|
|
|
2018-12-06 01:15:33 +01:00
|
|
|
* The :setting:`STATIC_URL` and :setting:`MEDIA_URL` settings set to relative
|
|
|
|
paths are now prefixed by the server-provided value of ``SCRIPT_NAME`` (or
|
|
|
|
``/`` if not set). This change should not affect settings set to valid URLs
|
|
|
|
or absolute paths.
|
|
|
|
|
2019-10-09 11:20:17 +02:00
|
|
|
* :class:`~django.middleware.http.ConditionalGetMiddleware` no longer adds the
|
|
|
|
``ETag`` header to responses with an empty
|
|
|
|
:attr:`~django.http.HttpResponse.content`.
|
|
|
|
|
2019-10-18 21:00:34 +02:00
|
|
|
* ``django.utils.decorators.classproperty()`` decorator is moved to
|
|
|
|
``django.utils.functional.classproperty()``.
|
|
|
|
|
2019-10-31 03:05:26 +01:00
|
|
|
* :tfilter:`floatformat` template filter now outputs (positive) ``0`` for
|
|
|
|
negative numbers which round to zero.
|
|
|
|
|
2019-09-05 14:46:01 +02:00
|
|
|
.. _deprecated-features-3.1:
|
|
|
|
|
|
|
|
Features deprecated in 3.1
|
|
|
|
==========================
|
|
|
|
|
|
|
|
Miscellaneous
|
|
|
|
-------------
|
|
|
|
|
2019-08-23 17:14:07 +02:00
|
|
|
* ``PASSWORD_RESET_TIMEOUT_DAYS`` setting is deprecated in favor of
|
|
|
|
:setting:`PASSWORD_RESET_TIMEOUT`.
|
2019-09-05 14:46:01 +02:00
|
|
|
|
2019-10-11 20:10:31 +02:00
|
|
|
* The undocumented usage of the :lookup:`isnull` lookup with non-boolean values
|
|
|
|
as the right-hand side is deprecated, use ``True`` or ``False`` instead.
|
|
|
|
|
2019-09-05 14:46:01 +02:00
|
|
|
.. _removed-features-3.1:
|
|
|
|
|
|
|
|
Features removed in 3.1
|
|
|
|
=======================
|
|
|
|
|
|
|
|
These features have reached the end of their deprecation cycle and are removed
|
|
|
|
in Django 3.1.
|
|
|
|
|
|
|
|
See :ref:`deprecated-features-2.2` for details on these changes, including how
|
|
|
|
to remove usage of these features.
|
|
|
|
|
2019-09-06 07:59:06 +02:00
|
|
|
* ``django.utils.timezone.FixedOffset`` is removed.
|
|
|
|
|
2019-09-06 08:07:20 +02:00
|
|
|
* ``django.core.paginator.QuerySetPaginator`` is removed.
|
|
|
|
|
2019-09-07 19:28:19 +02:00
|
|
|
* A model's ``Meta.ordering`` doesn't affect ``GROUP BY`` queries.
|
|
|
|
|
2019-09-05 16:10:21 +02:00
|
|
|
* ``django.contrib.postgres.fields.FloatRangeField`` and
|
|
|
|
``django.contrib.postgres.forms.FloatRangeField`` are removed.
|
2019-09-05 16:25:30 +02:00
|
|
|
|
|
|
|
* The ``FILE_CHARSET`` setting is removed.
|
2019-09-06 13:40:59 +02:00
|
|
|
|
|
|
|
* ``django.contrib.staticfiles.storage.CachedStaticFilesStorage`` is removed.
|
2019-09-07 11:57:46 +02:00
|
|
|
|
2019-09-07 15:58:49 +02:00
|
|
|
* The ``RemoteUserBackend.configure_user()`` method requires ``request`` as the
|
|
|
|
first positional argument.
|
|
|
|
|
2019-09-07 11:57:46 +02:00
|
|
|
* Support for ``SimpleTestCase.allow_database_queries`` and
|
|
|
|
``TransactionTestCase.multi_db`` is removed.
|