4.2.txt 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. ============================================
  2. Django 4.2 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. *Expected April 2023*
  5. Welcome to Django 4.2!
  6. These release notes cover the :ref:`new features <whats-new-4.2>`, as well as
  7. some :ref:`backwards incompatible changes <backwards-incompatible-4.2>` you'll
  8. want to be aware of when upgrading from Django 4.1 or earlier. We've
  9. :ref:`begun the deprecation process for some features
  10. <deprecated-features-4.2>`.
  11. See the :doc:`/howto/upgrade-version` guide if you're updating an existing
  12. project.
  13. Python compatibility
  14. ====================
  15. Django 4.2 supports Python 3.8, 3.9, 3.10, and 3.11. We **highly recommend**
  16. and only officially support the latest release of each series.
  17. .. _whats-new-4.2:
  18. What's new in Django 4.2
  19. ========================
  20. Minor features
  21. --------------
  22. :mod:`django.contrib.admin`
  23. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. * ...
  25. :mod:`django.contrib.admindocs`
  26. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. * ...
  28. :mod:`django.contrib.auth`
  29. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  30. * The default iteration count for the PBKDF2 password hasher is increased from
  31. 390,000 to 480,000.
  32. :mod:`django.contrib.contenttypes`
  33. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. * ...
  35. :mod:`django.contrib.gis`
  36. ~~~~~~~~~~~~~~~~~~~~~~~~~
  37. * The :doc:`GeoJSON serializer </ref/contrib/gis/serializers>` now outputs the
  38. ``id`` key for serialized features, which defaults to the primary key of
  39. objects.
  40. * The :class:`~django.contrib.gis.gdal.GDALRaster` class now supports
  41. :class:`pathlib.Path`.
  42. :mod:`django.contrib.messages`
  43. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  44. * ...
  45. :mod:`django.contrib.postgres`
  46. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47. * The new :lookup:`trigram_strict_word_similar` lookup, and the
  48. :class:`TrigramStrictWordSimilarity()
  49. <django.contrib.postgres.search.TrigramStrictWordSimilarity>` and
  50. :class:`TrigramStrictWordDistance()
  51. <django.contrib.postgres.search.TrigramStrictWordDistance>` expressions allow
  52. using trigram strict word similarity.
  53. :mod:`django.contrib.redirects`
  54. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. * ...
  56. :mod:`django.contrib.sessions`
  57. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58. * ...
  59. :mod:`django.contrib.sitemaps`
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. * ...
  62. :mod:`django.contrib.sites`
  63. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64. * ...
  65. :mod:`django.contrib.staticfiles`
  66. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. * ...
  68. :mod:`django.contrib.syndication`
  69. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70. * ...
  71. Cache
  72. ~~~~~
  73. * ...
  74. CSRF
  75. ~~~~
  76. * ...
  77. Decorators
  78. ~~~~~~~~~~
  79. * ...
  80. Email
  81. ~~~~~
  82. * ...
  83. Error Reporting
  84. ~~~~~~~~~~~~~~~
  85. * ...
  86. File Storage
  87. ~~~~~~~~~~~~
  88. * ...
  89. File Uploads
  90. ~~~~~~~~~~~~
  91. * ...
  92. Forms
  93. ~~~~~
  94. * ...
  95. Generic Views
  96. ~~~~~~~~~~~~~
  97. * ...
  98. Internationalization
  99. ~~~~~~~~~~~~~~~~~~~~
  100. * ...
  101. Logging
  102. ~~~~~~~
  103. * ...
  104. Management Commands
  105. ~~~~~~~~~~~~~~~~~~~
  106. * :djadmin:`makemessages` command now supports locales with private sub-tags
  107. such as ``nl_NL-x-informal``.
  108. * The new :option:`makemigrations --update` option merges model changes into
  109. the latest migration and optimizes the resulting operations.
  110. Migrations
  111. ~~~~~~~~~~
  112. * ...
  113. Models
  114. ~~~~~~
  115. * ...
  116. Requests and Responses
  117. ~~~~~~~~~~~~~~~~~~~~~~
  118. * ...
  119. Security
  120. ~~~~~~~~
  121. * ...
  122. Serialization
  123. ~~~~~~~~~~~~~
  124. * ...
  125. Signals
  126. ~~~~~~~
  127. * ...
  128. Templates
  129. ~~~~~~~~~
  130. * ...
  131. Tests
  132. ~~~~~
  133. * ...
  134. URLs
  135. ~~~~
  136. * ...
  137. Utilities
  138. ~~~~~~~~~
  139. * The new ``encoder`` parameter for :meth:`django.utils.html.json_script`
  140. function allows customizing a JSON encoder class.
  141. * The private internal vendored copy of ``urllib.parse.urlsplit()`` now strips
  142. ``'\r'``, ``'\n'``, and ``'\t'`` (see :cve:`2022-0391` and :bpo:`43882`).
  143. This is to protect projects that may be incorrectly using the internal
  144. ``url_has_allowed_host_and_scheme()`` function, instead of using one of the
  145. documented functions for handling URL redirects. The Django functions were
  146. not affected.
  147. Validators
  148. ~~~~~~~~~~
  149. * ...
  150. .. _backwards-incompatible-4.2:
  151. Backwards incompatible changes in 4.2
  152. =====================================
  153. Database backend API
  154. --------------------
  155. This section describes changes that may be needed in third-party database
  156. backends.
  157. * ...
  158. Dropped support for MariaDB 10.3
  159. --------------------------------
  160. Upstream support for MariaDB 10.3 ends in May 2023. Django 4.2 supports MariaDB
  161. 10.4 and higher.
  162. Dropped support for MySQL 5.7
  163. -----------------------------
  164. Upstream support for MySQL 5.7 ends in October 2023. Django 4.2 supports MySQL
  165. 8 and higher.
  166. Dropped support for PostgreSQL 11
  167. ---------------------------------
  168. Upstream support for PostgreSQL 11 ends in November 2023. Django 4.2 supports
  169. PostgreSQL 12 and higher.
  170. Miscellaneous
  171. -------------
  172. * The undocumented ``SimpleTemplateResponse.rendering_attrs`` and
  173. ``TemplateResponse.rendering_attrs`` are renamed to ``non_picklable_attrs``.
  174. * The undocumented ``django.http.multipartparser.parse_header()`` function is
  175. removed. Use ``django.utils.http.parse_header_parameters()`` instead.
  176. * :ttag:`{% blocktranslate asvar … %}<blocktranslate>` result is now marked as
  177. safe for (HTML) output purposes.
  178. .. _deprecated-features-4.2:
  179. Features deprecated in 4.2
  180. ==========================
  181. ``index_together`` option is deprecated in favor of ``indexes``
  182. ---------------------------------------------------------------
  183. The :attr:`Meta.index_together <django.db.models.Options.index_together>`
  184. option is deprecated in favor of the :attr:`~django.db.models.Options.indexes`
  185. option.
  186. Migrating existing ``index_together`` should be handled as a migration. For
  187. example::
  188. class Author(models.Model):
  189. rank = models.IntegerField()
  190. name = models.CharField(max_length=30)
  191. class Meta:
  192. index_together = [["rank", "name"]]
  193. Should become::
  194. class Author(models.Model):
  195. ranl = models.IntegerField()
  196. name = models.CharField(max_length=30)
  197. class Meta:
  198. indexes = [models.Index(fields=["rank", "name"])]
  199. Running the :djadmin:`makemigrations` command will generate a migration
  200. containing a :class:`~django.db.migrations.operations.RenameIndex` operation
  201. which will rename the existing index.
  202. Miscellaneous
  203. -------------
  204. * The ``BaseUserManager.make_random_password()`` method is deprecated. See
  205. `recipes and best practices
  206. <https://docs.python.org/3/library/secrets.html#recipes-and-best-practices>`_
  207. for using Python's :py:mod:`secrets` module to generate passwords.
  208. * The ``length_is`` template filter is deprecated in favor of :tfilter:`length`
  209. and the ``==`` operator within an :ttag:`{% if %}<if>` tag. For example
  210. .. code-block:: html+django
  211. {% if value|length == 4 %}…{% endif %}
  212. {% if value|length == 4 %}True{% else %}False{% endif %}
  213. instead of:
  214. .. code-block:: html+django
  215. {% if value|length_is:4 %}…{% endif %}
  216. {{ value|length_is:4 }}
  217. * ``django.contrib.auth.hashers.SHA1PasswordHasher``,
  218. ``django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher``, and
  219. ``django.contrib.auth.hashers.UnsaltedMD5PasswordHasher`` are deprecated.