4.0.txt 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. ============================================
  2. Django 4.0 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. *Expected December 2021*
  5. Welcome to Django 4.0!
  6. These release notes cover the :ref:`new features <whats-new-4.0>`, as well as
  7. some :ref:`backwards incompatible changes <backwards-incompatible-4.0>` you'll
  8. want to be aware of when upgrading from Django 3.2 or earlier. We've
  9. :ref:`begun the deprecation process for some features
  10. <deprecated-features-4.0>`.
  11. See the :doc:`/howto/upgrade-version` guide if you're updating an existing
  12. project.
  13. Python compatibility
  14. ====================
  15. Django 4.0 supports Python 3.8, 3.9, and 3.10. We **highly recommend** and only
  16. officially support the latest release of each series.
  17. The Django 3.2.x series is the last to support Python 3.6 and 3.7.
  18. .. _whats-new-4.0:
  19. What's new in Django 4.0
  20. ========================
  21. Minor features
  22. --------------
  23. :mod:`django.contrib.admin`
  24. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. * The ``admin/base.html`` template now has a new block ``header`` which
  26. contains the admin site header.
  27. :mod:`django.contrib.admindocs`
  28. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  29. * The admindocs now allows esoteric setups where :setting:`ROOT_URLCONF` is not
  30. a string.
  31. * The model section of the ``admindocs`` now shows cached properties.
  32. :mod:`django.contrib.auth`
  33. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. * The default iteration count for the PBKDF2 password hasher is increased from
  35. 260,000 to 320,000.
  36. * The new
  37. :attr:`LoginView.next_page <django.contrib.auth.views.LoginView.next_page>`
  38. attribute and
  39. :meth:`~django.contrib.auth.views.LoginView.get_default_redirect_url` method
  40. allow customizing the redirect after login.
  41. :mod:`django.contrib.contenttypes`
  42. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  43. * ...
  44. :mod:`django.contrib.gis`
  45. ~~~~~~~~~~~~~~~~~~~~~~~~~
  46. * ...
  47. :mod:`django.contrib.messages`
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. * ...
  50. :mod:`django.contrib.postgres`
  51. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  52. * The PostgreSQL backend now supports connecting by a service name. See
  53. :ref:`postgresql-connection-settings` for more details.
  54. :mod:`django.contrib.redirects`
  55. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  56. * ...
  57. :mod:`django.contrib.sessions`
  58. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  59. * ...
  60. :mod:`django.contrib.sitemaps`
  61. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  62. * ...
  63. :mod:`django.contrib.sites`
  64. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  65. * ...
  66. :mod:`django.contrib.staticfiles`
  67. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68. * ...
  69. :mod:`django.contrib.syndication`
  70. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  71. * ...
  72. Cache
  73. ~~~~~
  74. * ...
  75. CSRF
  76. ~~~~
  77. * ...
  78. Decorators
  79. ~~~~~~~~~~
  80. * ...
  81. Email
  82. ~~~~~
  83. * ...
  84. Error Reporting
  85. ~~~~~~~~~~~~~~~
  86. * ...
  87. File Storage
  88. ~~~~~~~~~~~~
  89. * ...
  90. File Uploads
  91. ~~~~~~~~~~~~
  92. * ...
  93. Forms
  94. ~~~~~
  95. * :class:`~django.forms.ModelChoiceField` now includes the provided value in
  96. the ``params`` argument of a raised
  97. :exc:`~django.core.exceptions.ValidationError` for the ``invalid_choice``
  98. error message. This allows custom error messages to use the ``%(value)s``
  99. placeholder.
  100. Generic Views
  101. ~~~~~~~~~~~~~
  102. * ...
  103. Internationalization
  104. ~~~~~~~~~~~~~~~~~~~~
  105. * ...
  106. Logging
  107. ~~~~~~~
  108. * ...
  109. Management Commands
  110. ~~~~~~~~~~~~~~~~~~~
  111. * The :djadmin:`runserver` management command now supports the
  112. :option:`--skip-checks` option.
  113. Migrations
  114. ~~~~~~~~~~
  115. * ...
  116. Models
  117. ~~~~~~
  118. * ...
  119. Requests and Responses
  120. ~~~~~~~~~~~~~~~~~~~~~~
  121. * ...
  122. Security
  123. ~~~~~~~~
  124. * ...
  125. Serialization
  126. ~~~~~~~~~~~~~
  127. * ...
  128. Signals
  129. ~~~~~~~
  130. * The new ``stdout`` argument for :func:`~django.db.models.signals.pre_migrate`
  131. and :func:`~django.db.models.signals.post_migrate` signals allows redirecting
  132. output to a stream-like object. It should be preferred over
  133. :py:data:`sys.stdout` and :py:func:`print` when emitting verbose output in
  134. order to allow proper capture when testing.
  135. Templates
  136. ~~~~~~~~~
  137. * ...
  138. Tests
  139. ~~~~~
  140. * ...
  141. URLs
  142. ~~~~
  143. * ...
  144. Utilities
  145. ~~~~~~~~~
  146. * ...
  147. Validators
  148. ~~~~~~~~~~
  149. * ...
  150. .. _backwards-incompatible-4.0:
  151. Backwards incompatible changes in 4.0
  152. =====================================
  153. Database backend API
  154. --------------------
  155. This section describes changes that may be needed in third-party database
  156. backends.
  157. * ...
  158. :mod:`django.contrib.gis`
  159. -------------------------
  160. * Support for PostGIS 2.3 is removed.
  161. Dropped support for PostgreSQL 9.6
  162. ----------------------------------
  163. Upstream support for PostgreSQL 9.6 ends in November 2021. Django 4.0 supports
  164. PostgreSQL 10 and higher.
  165. Dropped support for Oracle 12.2 and 18c
  166. ---------------------------------------
  167. Upstream support for Oracle 12.2 ends in March 2022 and for Oracle 18c it ends
  168. in June 2021. Django 3.2 will be supported until April 2024. Django 4.0
  169. officially supports Oracle 19c.
  170. Miscellaneous
  171. -------------
  172. * Support for ``cx_Oracle`` < 7.0 is removed.
  173. * Starting with 4.0, new projects are generated with :setting:`STATIC_URL` set
  174. to the relative path ``'static/'``. This allows for the ``SCRIPT_NAME`` to be
  175. prepended as necessary.
  176. .. _deprecated-features-4.0:
  177. Features deprecated in 4.0
  178. ==========================
  179. Miscellaneous
  180. -------------
  181. * ...
  182. Features removed in 4.0
  183. =======================
  184. These features have reached the end of their deprecation cycle and are removed
  185. in Django 4.0.
  186. See :ref:`deprecated-features-3.0` for details on these changes, including how
  187. to remove usage of these features.
  188. * ``django.utils.http.urlquote()``, ``urlquote_plus()``, ``urlunquote()``, and
  189. ``urlunquote_plus()`` are removed.
  190. * ``django.utils.encoding.force_text()`` and ``smart_text()`` are removed.
  191. * ``django.utils.translation.ugettext()``, ``ugettext_lazy()``,
  192. ``ugettext_noop()``, ``ungettext()``, and ``ungettext_lazy()`` are removed.
  193. * ``django.views.i18n.set_language()`` doesn't set the user language in
  194. ``request.session`` (key ``_language``).
  195. * ``alias=None`` is required in the signature of
  196. ``django.db.models.Expression.get_group_by_cols()`` subclasses.
  197. * ``django.utils.text.unescape_entities()`` is removed.
  198. * ``django.utils.http.is_safe_url()`` is removed.
  199. See :ref:`deprecated-features-3.1` for details on these changes, including how
  200. to remove usage of these features.
  201. * The ``PASSWORD_RESET_TIMEOUT_DAYS`` setting is removed.
  202. * The :lookup:`isnull` lookup no longer allows using non-boolean values as the
  203. right-hand side.
  204. * The ``django.db.models.query_utils.InvalidQuery`` exception class is removed.
  205. * The ``django-admin.py`` entry point is removed.
  206. * The ``HttpRequest.is_ajax()`` method is removed.
  207. * Support for the pre-Django 3.1 encoding format of cookies values used by
  208. ``django.contrib.messages.storage.cookie.CookieStorage`` is removed.
  209. * Support for the pre-Django 3.1 password reset tokens in the admin site (that
  210. use the SHA-1 hashing algorithm) is removed.
  211. * Support for the pre-Django 3.1 encoding format of sessions is removed.
  212. * Support for the pre-Django 3.1 ``django.core.signing.Signer`` signatures
  213. (encoded with the SHA-1 algorithm) is removed.
  214. * Support for the pre-Django 3.1 ``django.core.signing.dumps()`` signatures
  215. (encoded with the SHA-1 algorithm) in ``django.core.signing.loads()`` is
  216. removed.
  217. * Support for the pre-Django 3.1 user sessions (that use the SHA-1 algorithm)
  218. is removed.
  219. * The ``get_request`` argument for
  220. ``django.utils.deprecation.MiddlewareMixin.__init__()`` is required and
  221. doesn't accept ``None``.
  222. * The ``providing_args`` argument for ``django.dispatch.Signal`` is removed.
  223. * The ``length`` argument for ``django.utils.crypto.get_random_string()`` is
  224. required.
  225. * The ``list`` message for ``ModelMultipleChoiceField`` is removed.
  226. * Support for passing raw column aliases to ``QuerySet.order_by()`` is removed.
  227. * The ``NullBooleanField`` model field is removed, except for support in
  228. historical migrations.
  229. * ``django.conf.urls.url()`` is removed.
  230. * The ``django.contrib.postgres.fields.JSONField`` model field is removed,
  231. except for support in historical migrations.
  232. * ``django.contrib.postgres.fields.jsonb.KeyTransform`` and
  233. ``django.contrib.postgres.fields.jsonb.KeyTextTransform`` are removed.
  234. * ``django.contrib.postgres.forms.JSONField`` is removed.
  235. * The ``{% ifequal %}`` and ``{% ifnotequal %}`` template tags are removed.
  236. * The ``DEFAULT_HASHING_ALGORITHM`` transitional setting is removed.