3.1.txt 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. ============================================
  2. Django 3.1 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. *Expected August 2020*
  5. Welcome to Django 3.1!
  6. These release notes cover the :ref:`new features <whats-new-3.1>`, as well as
  7. some :ref:`backwards incompatible changes <backwards-incompatible-3.1>` you'll
  8. want to be aware of when upgrading from Django 3.0 or earlier. We've
  9. :ref:`dropped some features<removed-features-3.1>` that have reached the end of
  10. their deprecation cycle, and we've :ref:`begun the deprecation process for
  11. some features <deprecated-features-3.1>`.
  12. See the :doc:`/howto/upgrade-version` guide if you're updating an existing
  13. project.
  14. Python compatibility
  15. ====================
  16. Django 3.1 supports Python 3.6, 3.7, and 3.8. We **highly recommend** and only
  17. officially support the latest release of each series.
  18. .. _whats-new-3.1:
  19. What's new in Django 3.1
  20. ========================
  21. Minor features
  22. --------------
  23. :mod:`django.contrib.admin`
  24. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. * ...
  26. :mod:`django.contrib.admindocs`
  27. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  28. * ...
  29. :mod:`django.contrib.auth`
  30. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  31. * The default iteration count for the PBKDF2 password hasher is increased from
  32. 180,000 to 216,000.
  33. * Added the :setting:`PASSWORD_RESET_TIMEOUT` setting to define the minimum
  34. number of seconds a password reset link is valid for. This is encouraged
  35. instead of deprecated ``PASSWORD_RESET_TIMEOUT_DAYS``, which will be removed
  36. in Django 4.0.
  37. :mod:`django.contrib.contenttypes`
  38. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  39. * ...
  40. :mod:`django.contrib.gis`
  41. ~~~~~~~~~~~~~~~~~~~~~~~~~
  42. * :lookup:`relate` lookup is now supported on MariaDB.
  43. * Added the :attr:`.LinearRing.is_counterclockwise` property.
  44. :mod:`django.contrib.messages`
  45. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  46. * ...
  47. :mod:`django.contrib.postgres`
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. * The new :class:`~django.contrib.postgres.indexes.BloomIndex` class allows
  50. creating ``bloom`` indexes in the database. The new
  51. :class:`~django.contrib.postgres.operations.BloomExtension` migration
  52. operation installs the ``bloom`` extension to add support for this index.
  53. * :meth:`~django.db.models.Model.get_FOO_display` now supports
  54. :class:`~django.contrib.postgres.fields.ArrayField` and
  55. :class:`~django.contrib.postgres.fields.RangeField`.
  56. * The new :lookup:`rangefield.lower_inc`, :lookup:`rangefield.lower_inf`,
  57. :lookup:`rangefield.upper_inc`, and :lookup:`rangefield.upper_inf` allows
  58. querying :class:`~django.contrib.postgres.fields.RangeField` by a bound type.
  59. :mod:`django.contrib.redirects`
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. * ...
  62. :mod:`django.contrib.sessions`
  63. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64. * ...
  65. :mod:`django.contrib.sitemaps`
  66. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. * ...
  68. :mod:`django.contrib.sites`
  69. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70. * ...
  71. :mod:`django.contrib.staticfiles`
  72. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  73. * The :setting:`STATICFILES_DIRS` setting now supports :class:`pathlib.Path`.
  74. :mod:`django.contrib.syndication`
  75. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  76. * ...
  77. Cache
  78. ~~~~~
  79. * The :func:`~django.views.decorators.cache.cache_control` decorator and
  80. :func:`~django.utils.cache.patch_cache_control` method now support multiple
  81. field names in the ``no-cache`` directive for the ``Cache-Control`` header,
  82. according to :rfc:`7234#section-5.2.2.2`.
  83. * :meth:`~django.core.caches.cache.delete` now returns ``True`` if the key was
  84. successfully deleted, ``False`` otherwise.
  85. CSRF
  86. ~~~~
  87. * ...
  88. Email
  89. ~~~~~
  90. * The :setting:`EMAIL_FILE_PATH` setting, used by the :ref:`file email backend
  91. <topic-email-file-backend>`, now supports :class:`pathlib.Path`.
  92. File Storage
  93. ~~~~~~~~~~~~
  94. * ``FileSystemStorage.save()`` method now supports :class:`pathlib.Path`.
  95. File Uploads
  96. ~~~~~~~~~~~~
  97. * ...
  98. Forms
  99. ~~~~~
  100. * ...
  101. Generic Views
  102. ~~~~~~~~~~~~~
  103. * ...
  104. Internationalization
  105. ~~~~~~~~~~~~~~~~~~~~
  106. * ...
  107. Logging
  108. ~~~~~~~
  109. * ...
  110. Management Commands
  111. ~~~~~~~~~~~~~~~~~~~
  112. * ...
  113. Migrations
  114. ~~~~~~~~~~
  115. * Migrations are now loaded also from directories without ``__init__.py``
  116. files.
  117. Models
  118. ~~~~~~
  119. * The new :class:`~django.db.models.functions.ExtractIsoWeekDay` function
  120. extracts ISO-8601 week days from :class:`~django.db.models.DateField` and
  121. :class:`~django.db.models.DateTimeField`, and the new :lookup:`iso_week_day`
  122. lookup allows querying by an ISO-8601 day of week.
  123. * :meth:`.QuerySet.explain` now supports:
  124. * ``TREE`` format on MySQL 8.0.16+,
  125. * ``analyze`` option on MySQL 8.0.18+ and MariaDB.
  126. Pagination
  127. ~~~~~~~~~~
  128. * :class:`~django.core.paginator.Paginator` can now be iterated over to yield
  129. its pages.
  130. Requests and Responses
  131. ~~~~~~~~~~~~~~~~~~~~~~
  132. * ...
  133. Serialization
  134. ~~~~~~~~~~~~~
  135. * ...
  136. Signals
  137. ~~~~~~~
  138. * ...
  139. Templates
  140. ~~~~~~~~~
  141. * ...
  142. Tests
  143. ~~~~~
  144. * :class:`~django.test.SimpleTestCase` now implements the ``debug()`` method to
  145. allow running a test without collecting the result and catching exceptions.
  146. This can be used to support running tests under a debugger.
  147. URLs
  148. ~~~~
  149. * ...
  150. Utilities
  151. ~~~~~~~~~
  152. * :func:`~django.utils.encoding.filepath_to_uri` now supports
  153. :class:`pathlib.Path`.
  154. Validators
  155. ~~~~~~~~~~
  156. * ...
  157. Miscellaneous
  158. ~~~~~~~~~~~~~
  159. * The SQLite backend now supports :class:`pathlib.Path` for the ``NAME``
  160. setting.
  161. * The ``settings.py`` generated by the :djadmin:`startproject` command now uses
  162. :class:`pathlib.Path` instead of :mod:`os.path` for building filesystem
  163. paths.
  164. .. _backwards-incompatible-3.1:
  165. Backwards incompatible changes in 3.1
  166. =====================================
  167. Database backend API
  168. --------------------
  169. This section describes changes that may be needed in third-party database
  170. backends.
  171. * ``DatabaseOperations.fetch_returned_insert_columns()`` now requires an
  172. additional ``returning_params`` argument.
  173. Dropped support for MariaDB 10.1
  174. --------------------------------
  175. Upstream support for MariaDB 10.1 ends in October 2020. Django 3.1 supports
  176. MariaDB 10.2 and higher.
  177. Miscellaneous
  178. -------------
  179. * The cache keys used by :ttag:`cache` and generated by
  180. :func:`~django.core.cache.utils.make_template_fragment_key` are different
  181. from the keys generated by older versions of Django. After upgrading to
  182. Django 3.1, the first request to any previously cached template fragment will
  183. be a cache miss.
  184. * The compatibility imports of ``django.core.exceptions.EmptyResultSet`` in
  185. ``django.db.models.query``, ``django.db.models.sql``, and
  186. ``django.db.models.sql.datastructures`` are removed.
  187. * The compatibility import of ``django.core.exceptions.FieldDoesNotExist`` in
  188. ``django.db.models.fields`` is removed.
  189. * The compatibility imports of ``django.forms.utils.pretty_name()`` and
  190. ``django.forms.boundfield.BoundField`` in ``django.forms.forms`` are removed.
  191. * The compatibility imports of ``Context``, ``ContextPopException``, and
  192. ``RequestContext`` in ``django.template.base`` are removed.
  193. * The compatibility import of
  194. ``django.contrib.admin.helpers.ACTION_CHECKBOX_NAME`` in
  195. ``django.contrib.admin`` is removed.
  196. * The :setting:`STATIC_URL` and :setting:`MEDIA_URL` settings set to relative
  197. paths are now prefixed by the server-provided value of ``SCRIPT_NAME`` (or
  198. ``/`` if not set). This change should not affect settings set to valid URLs
  199. or absolute paths.
  200. * :class:`~django.middleware.http.ConditionalGetMiddleware` no longer adds the
  201. ``ETag`` header to responses with an empty
  202. :attr:`~django.http.HttpResponse.content`.
  203. * ``django.utils.decorators.classproperty()`` decorator is moved to
  204. ``django.utils.functional.classproperty()``.
  205. * :tfilter:`floatformat` template filter now outputs (positive) ``0`` for
  206. negative numbers which round to zero.
  207. * :attr:`Meta.ordering <django.db.models.Options.ordering>` and
  208. :attr:`Meta.unique_together <django.db.models.Options.unique_together>`
  209. options on models in ``django.contrib`` modules that were formerly tuples are
  210. now lists.
  211. .. _deprecated-features-3.1:
  212. Features deprecated in 3.1
  213. ==========================
  214. Miscellaneous
  215. -------------
  216. * ``PASSWORD_RESET_TIMEOUT_DAYS`` setting is deprecated in favor of
  217. :setting:`PASSWORD_RESET_TIMEOUT`.
  218. * The undocumented usage of the :lookup:`isnull` lookup with non-boolean values
  219. as the right-hand side is deprecated, use ``True`` or ``False`` instead.
  220. * The barely documented ``django.db.models.query_utils.InvalidQuery`` exception
  221. class is deprecated in favor of
  222. :class:`~django.core.exceptions.FieldDoesNotExist` and
  223. :class:`~django.core.exceptions.FieldError`.
  224. .. _removed-features-3.1:
  225. Features removed in 3.1
  226. =======================
  227. These features have reached the end of their deprecation cycle and are removed
  228. in Django 3.1.
  229. See :ref:`deprecated-features-2.2` for details on these changes, including how
  230. to remove usage of these features.
  231. * ``django.utils.timezone.FixedOffset`` is removed.
  232. * ``django.core.paginator.QuerySetPaginator`` is removed.
  233. * A model's ``Meta.ordering`` doesn't affect ``GROUP BY`` queries.
  234. * ``django.contrib.postgres.fields.FloatRangeField`` and
  235. ``django.contrib.postgres.forms.FloatRangeField`` are removed.
  236. * The ``FILE_CHARSET`` setting is removed.
  237. * ``django.contrib.staticfiles.storage.CachedStaticFilesStorage`` is removed.
  238. * The ``RemoteUserBackend.configure_user()`` method requires ``request`` as the
  239. first positional argument.
  240. * Support for ``SimpleTestCase.allow_database_queries`` and
  241. ``TransactionTestCase.multi_db`` is removed.