5.2.txt 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. ============================================
  2. Django 5.2 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. *Expected April 2025*
  5. Welcome to Django 5.2!
  6. These release notes cover the :ref:`new features <whats-new-5.2>`, as well as
  7. some :ref:`backwards incompatible changes <backwards-incompatible-5.2>` you
  8. should be aware of when upgrading from Django 5.1 or earlier. We've
  9. :ref:`begun the deprecation process for some features
  10. <deprecated-features-5.2>`.
  11. See the :doc:`/howto/upgrade-version` guide if you're updating an existing
  12. project.
  13. Django 5.2 is designated as a :term:`long-term support release
  14. <Long-term support release>`. It will receive security updates for at least
  15. three years after its release. Support for the previous LTS, Django 4.2, will
  16. end in April 2026.
  17. Python compatibility
  18. ====================
  19. Django 5.2 supports Python 3.10, 3.11, 3.12, and 3.13. We **highly recommend**
  20. and only officially support the latest release of each series.
  21. .. _whats-new-5.2:
  22. What's new in Django 5.2
  23. ========================
  24. Minor features
  25. --------------
  26. :mod:`django.contrib.admin`
  27. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  28. * The ``admin/base.html`` template now has a new block
  29. :ref:`extrabody <extrabody>` for adding custom code before the closing
  30. ``</body>`` tag.
  31. :mod:`django.contrib.admindocs`
  32. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  33. * ...
  34. :mod:`django.contrib.auth`
  35. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  36. * The default iteration count for the PBKDF2 password hasher is increased from
  37. 870,000 to 1,000,000.
  38. :mod:`django.contrib.contenttypes`
  39. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  40. * ...
  41. :mod:`django.contrib.gis`
  42. ~~~~~~~~~~~~~~~~~~~~~~~~~
  43. * ...
  44. :mod:`django.contrib.messages`
  45. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  46. * ...
  47. :mod:`django.contrib.postgres`
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. * ...
  50. :mod:`django.contrib.redirects`
  51. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  52. * ...
  53. :mod:`django.contrib.sessions`
  54. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. * ...
  56. :mod:`django.contrib.sitemaps`
  57. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58. * ...
  59. :mod:`django.contrib.sites`
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. * ...
  62. :mod:`django.contrib.staticfiles`
  63. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64. * ...
  65. :mod:`django.contrib.syndication`
  66. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. * All :class:`~django.utils.feedgenerator.SyndicationFeed` classes now support
  68. a ``stylesheets`` attribute. If specified, an ``<? xml-stylesheet ?>``
  69. processing instruction will be added to the top of the document for each
  70. stylesheet in the given list. See :ref:`feed-stylesheets` for more details.
  71. Asynchronous views
  72. ~~~~~~~~~~~~~~~~~~
  73. * ...
  74. Cache
  75. ~~~~~
  76. * ...
  77. CSRF
  78. ~~~~
  79. * ...
  80. Database backends
  81. ~~~~~~~~~~~~~~~~~
  82. * ...
  83. Decorators
  84. ~~~~~~~~~~
  85. * :func:`~django.utils.decorators.method_decorator` now supports wrapping
  86. asynchronous view methods.
  87. Email
  88. ~~~~~
  89. * Tuple items of :class:`EmailMessage.attachments
  90. <django.core.mail.EmailMessage>` and
  91. :class:`EmailMultiAlternatives.attachments
  92. <django.core.mail.EmailMultiAlternatives>` are now named tuples, as opposed
  93. to regular tuples.
  94. * :attr:`EmailMultiAlternatives.alternatives
  95. <django.core.mail.EmailMultiAlternatives.alternatives>` is now a list of
  96. named tuples, as opposed to regular tuples.
  97. * The new :meth:`~django.core.mail.EmailMultiAlternatives.body_contains` method
  98. returns a boolean indicating whether a provided text is contained in the
  99. email ``body`` and in all attached MIME type ``text/*`` alternatives.
  100. Error Reporting
  101. ~~~~~~~~~~~~~~~
  102. * The attribute :attr:`.SafeExceptionReporterFilter.hidden_settings` now
  103. treats values as sensitive if their name includes ``AUTH``.
  104. File Storage
  105. ~~~~~~~~~~~~
  106. * ...
  107. File Uploads
  108. ~~~~~~~~~~~~
  109. * ...
  110. Forms
  111. ~~~~~
  112. * The new :class:`~django.forms.ColorInput` form widget is for entering a color
  113. in ``rrggbb`` hexadecimal format and renders as ``<input type="color" ...>``.
  114. Some browsers support a visual color picker interface for this input type.
  115. * The new :class:`~django.forms.SearchInput` form widget is for entering search
  116. queries and renders as ``<input type="search" ...>``.
  117. * The new :class:`~django.forms.TelInput` form widget is for entering telephone
  118. numbers and renders as ``<input type="tel" ...>``.
  119. Generic Views
  120. ~~~~~~~~~~~~~
  121. * ...
  122. Internationalization
  123. ~~~~~~~~~~~~~~~~~~~~
  124. * ...
  125. Logging
  126. ~~~~~~~
  127. * ...
  128. Management Commands
  129. ~~~~~~~~~~~~~~~~~~~
  130. * A new warning is printed to the console when running :djadmin:`runserver` that
  131. ``runserver`` is unsuitable for production. This warning can be hidden by
  132. setting the :envvar:`HIDE_PRODUCTION_WARNING` environment variable to
  133. ``"true"``.
  134. Migrations
  135. ~~~~~~~~~~
  136. * ...
  137. Models
  138. ~~~~~~
  139. * The ``SELECT`` clause generated when using
  140. :meth:`QuerySet.values()<django.db.models.query.QuerySet.values>` and
  141. :meth:`~django.db.models.query.QuerySet.values_list` now matches the
  142. specified order of the referenced expressions. Previously the order was based
  143. of a set of counterintuitive rules which made query combination through
  144. methods such as
  145. :meth:`QuerySet.union()<django.db.models.query.QuerySet.union>` unpredictable.
  146. * Added support for validation of model constraints which use a
  147. :class:`~django.db.models.GeneratedField`.
  148. * The new :attr:`.Expression.set_returning` attribute specifies that the
  149. expression contains a set-returning function, enforcing subquery evaluation.
  150. This is necessary for many Postgres set-returning functions.
  151. * :attr:`CharField.max_length <django.db.models.CharField.max_length>` is no
  152. longer required to be set on SQLite, which supports unlimited ``VARCHAR``
  153. columns.
  154. Requests and Responses
  155. ~~~~~~~~~~~~~~~~~~~~~~
  156. * The new :meth:`.HttpRequest.get_preferred_type` method can be used to query
  157. the preferred media type the client accepts.
  158. Security
  159. ~~~~~~~~
  160. * ...
  161. Serialization
  162. ~~~~~~~~~~~~~
  163. * ...
  164. Signals
  165. ~~~~~~~
  166. * ...
  167. Templates
  168. ~~~~~~~~~
  169. * ...
  170. Tests
  171. ~~~~~
  172. * Stack frames from Django's custom assertions are now hidden. This makes test
  173. failures easier to read and enables :option:`test --pdb` to directly enter
  174. into the failing test method.
  175. URLs
  176. ~~~~
  177. * ...
  178. Utilities
  179. ~~~~~~~~~
  180. * :class:`~django.utils.safestring.SafeString` now returns
  181. :py:data:`NotImplemented` in ``__add__`` for non-string right-hand side
  182. values. This aligns with the :py:class:`str` addition behavior and allows
  183. ``__radd__`` to be used if available.
  184. * :func:`~django.utils.html.format_html_join` now supports taking an iterable
  185. of mappings, passing their contents as keyword arguments to
  186. :func:`~django.utils.html.format_html`.
  187. Validators
  188. ~~~~~~~~~~
  189. * ...
  190. .. _backwards-incompatible-5.2:
  191. Backwards incompatible changes in 5.2
  192. =====================================
  193. Database backend API
  194. --------------------
  195. This section describes changes that may be needed in third-party database
  196. backends.
  197. * The new :meth:`Model._is_pk_set() <django.db.models.Model._is_pk_set>` method
  198. allows checking if a Model instance's primary key is defined.
  199. :mod:`django.contrib.gis`
  200. -------------------------
  201. * Support for PostGIS 3.0 is removed.
  202. Dropped support for PostgreSQL 13
  203. ---------------------------------
  204. Upstream support for PostgreSQL 13 ends in November 2025. Django 5.2 supports
  205. PostgreSQL 14 and higher.
  206. Miscellaneous
  207. -------------
  208. * Adding :attr:`.EmailMultiAlternatives.alternatives` is now only supported via
  209. the :meth:`~.EmailMultiAlternatives.attach_alternative` method.
  210. * The minimum supported version of ``gettext`` is increased from 0.15 to 0.19.
  211. * ``HttpRequest.accepted_types`` is now sorted by the client's preference, based
  212. on the request's ``Accept`` header.
  213. .. _deprecated-features-5.2:
  214. Features deprecated in 5.2
  215. ==========================
  216. Miscellaneous
  217. -------------
  218. * The ``all`` argument for the ``django.contrib.staticfiles.finders.find()``
  219. function is deprecated in favor of the ``find_all`` argument.