4.1.txt 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. ============================================
  2. Django 4.1 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. *Expected August 2022*
  5. Welcome to Django 4.1!
  6. These release notes cover the :ref:`new features <whats-new-4.1>`, as well as
  7. some :ref:`backwards incompatible changes <backwards-incompatible-4.1>` you'll
  8. want to be aware of when upgrading from Django 4.0 or earlier. We've
  9. :ref:`begun the deprecation process for some features
  10. <deprecated-features-4.1>`.
  11. See the :doc:`/howto/upgrade-version` guide if you're updating an existing
  12. project.
  13. Python compatibility
  14. ====================
  15. Django 4.1 supports Python 3.8, 3.9, and 3.10. We **highly recommend** and only
  16. officially support the latest release of each series.
  17. .. _whats-new-4.1:
  18. What's new in Django 4.1
  19. ========================
  20. Minor features
  21. --------------
  22. :mod:`django.contrib.admin`
  23. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. * The admin :ref:`dark mode CSS variables <admin-theming>` are now applied in a
  25. separate stylesheet and template block.
  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. 320,000 to 390,000.
  33. :mod:`django.contrib.contenttypes`
  34. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. * ...
  36. :mod:`django.contrib.gis`
  37. ~~~~~~~~~~~~~~~~~~~~~~~~~
  38. * The new :meth:`.GEOSGeometry.make_valid()` method allows converting invalid
  39. geometries to valid ones.
  40. :mod:`django.contrib.messages`
  41. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42. * ...
  43. :mod:`django.contrib.postgres`
  44. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. * The new :class:`BitXor() <django.contrib.postgres.aggregates.BitXor>`
  46. aggregate function returns an ``int`` of the bitwise ``XOR`` of all non-null
  47. input values.
  48. * :class:`~django.contrib.postgres.indexes.SpGistIndex` now supports covering
  49. indexes on PostgreSQL 14+.
  50. * :class:`~django.contrib.postgres.constraints.ExclusionConstraint` now
  51. supports covering exclusion constraints using SP-GiST indexes on PostgreSQL
  52. 14+.
  53. * The new ``default_bounds`` attribute of :attr:`DateTimeRangeField
  54. <django.contrib.postgres.fields.DateTimeRangeField.default_bounds>` and
  55. :attr:`DecimalRangeField
  56. <django.contrib.postgres.fields.DecimalRangeField.default_bounds>` allows
  57. specifying bounds for list and tuple inputs.
  58. :mod:`django.contrib.redirects`
  59. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  60. * ...
  61. :mod:`django.contrib.sessions`
  62. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  63. * ...
  64. :mod:`django.contrib.sitemaps`
  65. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  66. * The default sitemap index template ``<sitemapindex>`` now includes the
  67. ``<lastmod>`` timestamp where available, through the new
  68. :meth:`~django.contrib.sitemaps.Sitemap.get_latest_lastmod` method. Custom
  69. sitemap index templates should be updated for the adjusted :ref:`context
  70. variables <sitemap-index-context-variables>`.
  71. :mod:`django.contrib.sites`
  72. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  73. * ...
  74. :mod:`django.contrib.staticfiles`
  75. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  76. * ...
  77. :mod:`django.contrib.syndication`
  78. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  79. * ...
  80. Cache
  81. ~~~~~
  82. * ...
  83. CSRF
  84. ~~~~
  85. * ...
  86. Decorators
  87. ~~~~~~~~~~
  88. * ...
  89. Email
  90. ~~~~~
  91. * ...
  92. Error Reporting
  93. ~~~~~~~~~~~~~~~
  94. * ...
  95. File Storage
  96. ~~~~~~~~~~~~
  97. * ...
  98. File Uploads
  99. ~~~~~~~~~~~~
  100. * ...
  101. Forms
  102. ~~~~~
  103. * ...
  104. Generic Views
  105. ~~~~~~~~~~~~~
  106. * ...
  107. Internationalization
  108. ~~~~~~~~~~~~~~~~~~~~
  109. * ...
  110. Logging
  111. ~~~~~~~
  112. * ...
  113. Management Commands
  114. ~~~~~~~~~~~~~~~~~~~
  115. * :option:`makemigrations --no-input` now logs default answers and reasons why
  116. migrations cannot be created.
  117. Migrations
  118. ~~~~~~~~~~
  119. * ...
  120. Models
  121. ~~~~~~
  122. * ...
  123. Requests and Responses
  124. ~~~~~~~~~~~~~~~~~~~~~~
  125. * ...
  126. Security
  127. ~~~~~~~~
  128. * ...
  129. Serialization
  130. ~~~~~~~~~~~~~
  131. * ...
  132. Signals
  133. ~~~~~~~
  134. * ...
  135. Templates
  136. ~~~~~~~~~
  137. * ...
  138. Tests
  139. ~~~~~
  140. * A nested atomic block marked as durable in :class:`django.test.TestCase` now
  141. raises a ``RuntimeError``, the same as outside of tests.
  142. URLs
  143. ~~~~
  144. * ...
  145. Utilities
  146. ~~~~~~~~~
  147. * ...
  148. Validators
  149. ~~~~~~~~~~
  150. * ...
  151. .. _backwards-incompatible-4.1:
  152. Backwards incompatible changes in 4.1
  153. =====================================
  154. Database backend API
  155. --------------------
  156. This section describes changes that may be needed in third-party database
  157. backends.
  158. * ``BaseDatabaseFeatures.has_case_insensitive_like`` is changed from ``True``
  159. to ``False`` to reflect the behavior of most databases.
  160. * ``DatabaseIntrospection.get_key_columns()`` is removed. Use
  161. ``DatabaseIntrospection.get_relations()`` instead.
  162. Dropped support for MariaDB 10.2
  163. --------------------------------
  164. Upstream support for MariaDB 10.2 ends in May 2022. Django 4.1 supports MariaDB
  165. 10.3 and higher.
  166. Miscellaneous
  167. -------------
  168. * Related managers for :class:`~django.db.models.ForeignKey`,
  169. :class:`~django.db.models.ManyToManyField`, and
  170. :class:`~django.contrib.contenttypes.fields.GenericRelation` are now cached
  171. on the :class:`~django.db.models.Model` instance to which they belong.
  172. * The Django test runner now returns a non-zero error code for unexpected
  173. successes from tests marked with :py:func:`unittest.expectedFailure`.
  174. .. _deprecated-features-4.1:
  175. Features deprecated in 4.1
  176. ==========================
  177. Miscellaneous
  178. -------------
  179. * The context for sitemap index templates of a flat list of URLs is deprecated.
  180. Custom sitemap index templates should be updated for the adjusted
  181. :ref:`context variables <sitemap-index-context-variables>`, expecting a list
  182. of objects with ``location`` and optional ``lastmod`` attributes.
  183. Features removed in 4.1
  184. =======================
  185. These features have reached the end of their deprecation cycle and are removed
  186. in Django 4.1.
  187. See :ref:`deprecated-features-3.2` for details on these changes, including how
  188. to remove usage of these features.
  189. * Support for assigning objects which don't support creating deep copies with
  190. ``copy.deepcopy()`` to class attributes in ``TestCase.setUpTestData()`` is
  191. removed.
  192. * Support for using a boolean value in
  193. :attr:`.BaseCommand.requires_system_checks` is removed.
  194. * The ``whitelist`` argument and ``domain_whitelist`` attribute of
  195. ``django.core.validators.EmailValidator`` are removed.
  196. * The ``default_app_config`` application configuration variable is removed.
  197. * ``TransactionTestCase.assertQuerysetEqual()`` no longer calls ``repr()`` on a
  198. queryset when compared to string values.
  199. * The ``django.core.cache.backends.memcached.MemcachedCache`` backend is
  200. removed.
  201. * Support for the pre-Django 3.2 format of messages used by
  202. ``django.contrib.messages.storage.cookie.CookieStorage`` is removed.