4.2.txt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  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. Psycopg 3 support
  21. -----------------
  22. Django now supports `psycopg`_ version 3.1 or higher. To update your code,
  23. install the `psycopg library`_, you don't need to change the
  24. :setting:`ENGINE <DATABASE-ENGINE>` as ``django.db.backends.postgresql``
  25. supports both libraries.
  26. Support for ``psycopg2`` is likely to be deprecated and removed at some point
  27. in the future.
  28. .. _psycopg: https://www.psycopg.org/psycopg3/
  29. .. _psycopg library: https://pypi.org/project/psycopg/
  30. Comments on columns and tables
  31. ------------------------------
  32. The new :attr:`Field.db_comment <django.db.models.Field.db_comment>` and
  33. :attr:`Meta.db_table_comment <django.db.models.Options.db_table_comment>`
  34. options allow creating comments on columns and tables, respectively. For
  35. example::
  36. from django.db import models
  37. class Question(models.Model):
  38. text = models.TextField(db_comment="Poll question")
  39. pub_date = models.DateTimeField(
  40. db_comment="Date and time when the question was published",
  41. )
  42. class Meta:
  43. db_table_comment = "Poll questions"
  44. class Answer(models.Model):
  45. question = models.ForeignKey(
  46. Question,
  47. on_delete=models.CASCADE,
  48. db_comment="Reference to a question"
  49. )
  50. answer = models.TextField(db_comment="Question answer")
  51. class Meta:
  52. db_table_comment = "Question answers"
  53. Also, the new :class:`~django.db.migrations.operations.AlterModelTableComment`
  54. operation allows changing table comments defined in the
  55. :attr:`Meta.db_table_comment <django.db.models.Options.db_table_comment>`.
  56. Mitigation for the BREACH attack
  57. --------------------------------
  58. :class:`~django.middleware.gzip.GZipMiddleware` now includes a mitigation for
  59. the BREACH attack. It will add up to 100 random bytes to gzip responses to make
  60. BREACH attacks harder. Read more about the mitigation technique in the `Heal
  61. The Breach (HTB) paper`_.
  62. .. _Heal The Breach (HTB) paper: https://ieeexplore.ieee.org/document/9754554
  63. In-memory file storage
  64. ----------------------
  65. The new ``django.core.files.storage.InMemoryStorage`` class provides a
  66. non-persistent storage useful for speeding up tests by avoiding disk access.
  67. Custom file storages
  68. --------------------
  69. The new :setting:`STORAGES` setting allows configuring multiple custom file
  70. storage backends. It also controls storage engines for managing
  71. :doc:`files </topics/files>` (the ``"defaut"`` key) and :doc:`static files
  72. </ref/contrib/staticfiles>` (the ``"staticfiles"`` key).
  73. The old ``DEFAULT_FILE_STORAGE`` and ``STATICFILES_STORAGE`` settings are
  74. deprecated as of this release.
  75. Minor features
  76. --------------
  77. :mod:`django.contrib.admin`
  78. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  79. * The light or dark color theme of the admin can now be toggled in the UI, as
  80. well as being set to follow the system setting.
  81. * The admin's font stack now prefers system UI fonts and no longer requires
  82. downloading fonts. Additionally, CSS variables are available to more easily
  83. override the default font families.
  84. * The :source:`admin/delete_confirmation.html
  85. <django/contrib/admin/templates/admin/delete_confirmation.html>` template now
  86. has some additional blocks and scripting hooks to ease customization.
  87. * The chosen options of
  88. :attr:`~django.contrib.admin.ModelAdmin.filter_horizontal` and
  89. :attr:`~django.contrib.admin.ModelAdmin.filter_vertical` widgets are now
  90. filterable.
  91. * The ``admin/base.html`` template now has a new block ``nav-breadcrumbs``
  92. which contains the navigation landmark and the ``breadcrumbs`` block.
  93. * :attr:`.ModelAdmin.list_editable` now uses atomic transactions when making
  94. edits.
  95. * jQuery is upgraded from version 3.6.0 to 3.6.3.
  96. :mod:`django.contrib.admindocs`
  97. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  98. * ...
  99. :mod:`django.contrib.auth`
  100. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  101. * The default iteration count for the PBKDF2 password hasher is increased from
  102. 390,000 to 480,000.
  103. * :class:`~django.contrib.auth.forms.UserCreationForm` now saves many-to-many
  104. form fields for a custom user model.
  105. * The new :class:`~django.contrib.auth.forms.BaseUserCreationForm` is now the
  106. recommended base class for customizing the user creation form.
  107. :mod:`django.contrib.contenttypes`
  108. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  109. * ...
  110. :mod:`django.contrib.gis`
  111. ~~~~~~~~~~~~~~~~~~~~~~~~~
  112. * The :doc:`GeoJSON serializer </ref/contrib/gis/serializers>` now outputs the
  113. ``id`` key for serialized features, which defaults to the primary key of
  114. objects.
  115. * The :class:`~django.contrib.gis.gdal.GDALRaster` class now supports
  116. :class:`pathlib.Path`.
  117. * The :class:`~django.contrib.gis.geoip2.GeoIP2` class now supports ``.mmdb``
  118. files downloaded from DB-IP.
  119. * The OpenLayers template widget no longer includes inline CSS (which also
  120. removes the former ``map_css`` block) to better comply with a strict Content
  121. Security Policy.
  122. * :class:`~django.contrib.gis.forms.widgets.OpenLayersWidget` is now based on
  123. OpenLayers 7.2.2 (previously 4.6.5).
  124. * The new :lookup:`isempty` lookup and
  125. :class:`IsEmpty() <django.contrib.gis.db.models.functions.IsEmpty>`
  126. expression allow filtering empty geometries on PostGIS.
  127. * The new :class:`FromWKB() <django.contrib.gis.db.models.functions.FromWKB>`
  128. and :class:`FromWKT() <django.contrib.gis.db.models.functions.FromWKT>`
  129. functions allow creating geometries from Well-known binary (WKB) and
  130. Well-known text (WKT) representations.
  131. :mod:`django.contrib.messages`
  132. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  133. * ...
  134. :mod:`django.contrib.postgres`
  135. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  136. * The new :lookup:`trigram_strict_word_similar` lookup, and the
  137. :class:`TrigramStrictWordSimilarity()
  138. <django.contrib.postgres.search.TrigramStrictWordSimilarity>` and
  139. :class:`TrigramStrictWordDistance()
  140. <django.contrib.postgres.search.TrigramStrictWordDistance>` expressions allow
  141. using trigram strict word similarity.
  142. * The :lookup:`arrayfield.overlap` lookup now supports ``QuerySet.values()``
  143. and ``values_list()`` as a right-hand side.
  144. :mod:`django.contrib.redirects`
  145. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  146. * ...
  147. :mod:`django.contrib.sessions`
  148. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  149. * ...
  150. :mod:`django.contrib.sitemaps`
  151. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  152. * The new :meth:`.Sitemap.get_languages_for_item` method allows customizing the
  153. list of languages for which the item is displayed.
  154. :mod:`django.contrib.sites`
  155. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  156. * ...
  157. :mod:`django.contrib.staticfiles`
  158. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  159. * :class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage` now
  160. replaces paths to JavaScript modules in ``import`` and ``export`` statements
  161. with their hashed counterparts.
  162. * The new :attr:`.ManifestStaticFilesStorage.manifest_hash` attribute provides
  163. a hash over all files in the manifest and changes whenever one of the files
  164. changes.
  165. :mod:`django.contrib.syndication`
  166. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  167. * ...
  168. Cache
  169. ~~~~~
  170. * ...
  171. CSRF
  172. ~~~~
  173. * ...
  174. Database backends
  175. ~~~~~~~~~~~~~~~~~
  176. * The new ``"assume_role"`` option is now supported in :setting:`OPTIONS` on
  177. PostgreSQL to allow specifying the :ref:`session role <database-role>`.
  178. Decorators
  179. ~~~~~~~~~~
  180. * ...
  181. Email
  182. ~~~~~
  183. * ...
  184. Error Reporting
  185. ~~~~~~~~~~~~~~~
  186. * The debug page now shows :pep:`exception notes <678>` and
  187. :pep:`fine-grained error locations <657>` on Python 3.11+.
  188. File Storage
  189. ~~~~~~~~~~~~
  190. * ...
  191. File Uploads
  192. ~~~~~~~~~~~~
  193. * ...
  194. Forms
  195. ~~~~~
  196. * :class:`~django.forms.ModelForm` now accepts the new ``Meta`` option
  197. ``formfield_callback`` to customize form fields.
  198. * :func:`~django.forms.models.modelform_factory` now respects the
  199. ``formfield_callback`` attribute of the ``form``’s ``Meta``.
  200. * Session cookies are now treated as credentials and therefore hidden and
  201. replaced with stars (``**********``) in error reports.
  202. Generic Views
  203. ~~~~~~~~~~~~~
  204. * ...
  205. Internationalization
  206. ~~~~~~~~~~~~~~~~~~~~
  207. * Added support and translations for the Central Kurdish (Sorani) language.
  208. * The :class:`~django.middleware.locale.LocaleMiddleware` now respects a
  209. language from the request when :func:`~django.conf.urls.i18n.i18n_patterns`
  210. is used with the ``prefix_default_language`` argument set to ``False``.
  211. Logging
  212. ~~~~~~~
  213. * The :ref:`django-db-logger` logger now logs transaction management queries
  214. (``BEGIN``, ``COMMIT``, and ``ROLLBACK``) at the ``DEBUG`` level.
  215. Management Commands
  216. ~~~~~~~~~~~~~~~~~~~
  217. * :djadmin:`makemessages` command now supports locales with private sub-tags
  218. such as ``nl_NL-x-informal``.
  219. * The new :option:`makemigrations --update` option merges model changes into
  220. the latest migration and optimizes the resulting operations.
  221. Migrations
  222. ~~~~~~~~~~
  223. * Migrations now support serialization of ``enum.Flag`` objects.
  224. Models
  225. ~~~~~~
  226. * ``QuerySet`` now extensively supports filtering against
  227. :ref:`window-functions` with the exception of disjunctive filter lookups
  228. against window functions when performing aggregation.
  229. * :meth:`~.QuerySet.prefetch_related` now supports
  230. :class:`~django.db.models.Prefetch` objects with sliced querysets.
  231. * :ref:`Registering lookups <lookup-registration-api>` on
  232. :class:`~django.db.models.Field` instances is now supported.
  233. * The new ``robust`` argument for :func:`~django.db.transaction.on_commit`
  234. allows performing actions that can fail after a database transaction is
  235. successfully committed.
  236. * The new :class:`KT() <django.db.models.fields.json.KT>` expression represents
  237. the text value of a key, index, or path transform of
  238. :class:`~django.db.models.JSONField`.
  239. * :class:`~django.db.models.functions.Now` now supports microsecond precision
  240. on MySQL and millisecond precision on SQLite.
  241. * :class:`F() <django.db.models.F>` expressions that output ``BooleanField``
  242. can now be negated using ``~F()`` (inversion operator).
  243. * ``Model`` now provides asynchronous versions of some methods that use the
  244. database, using an ``a`` prefix: :meth:`~.Model.adelete`,
  245. :meth:`~.Model.arefresh_from_db`, and :meth:`~.Model.asave`.
  246. * Related managers now provide asynchronous versions of methods that change a
  247. set of related objects, using an ``a`` prefix: :meth:`~.RelatedManager.aadd`,
  248. :meth:`~.RelatedManager.aclear`, :meth:`~.RelatedManager.aremove`, and
  249. :meth:`~.RelatedManager.aset`.
  250. * :attr:`CharField.max_length <django.db.models.CharField.max_length>` is no
  251. longer required to be set on PostgreSQL, which supports unlimited ``VARCHAR``
  252. columns.
  253. Requests and Responses
  254. ~~~~~~~~~~~~~~~~~~~~~~
  255. * :class:`~django.http.StreamingHttpResponse` now supports async iterators
  256. when Django is served via ASGI.
  257. Security
  258. ~~~~~~~~
  259. * ...
  260. Serialization
  261. ~~~~~~~~~~~~~
  262. * ...
  263. Signals
  264. ~~~~~~~
  265. * ...
  266. Templates
  267. ~~~~~~~~~
  268. * ...
  269. Tests
  270. ~~~~~
  271. * The :option:`test --debug-sql` option now formats SQL queries with
  272. ``sqlparse``.
  273. * The :class:`~django.test.RequestFactory`,
  274. :class:`~django.test.AsyncRequestFactory`, :class:`~django.test.Client`, and
  275. :class:`~django.test.AsyncClient` classes now support the ``headers``
  276. parameter, which accepts a dictionary of header names and values. This allows
  277. a more natural syntax for declaring headers.
  278. .. code-block:: python
  279. # Before:
  280. self.client.get("/home/", HTTP_ACCEPT_LANGUAGE="fr")
  281. await self.async_client.get("/home/", ACCEPT_LANGUAGE="fr")
  282. # After:
  283. self.client.get("/home/", headers={"accept-language": "fr"})
  284. await self.async_client.get("/home/", headers={"accept-language": "fr"})
  285. URLs
  286. ~~~~
  287. * ...
  288. Utilities
  289. ~~~~~~~~~
  290. * The new ``encoder`` parameter for :meth:`django.utils.html.json_script`
  291. function allows customizing a JSON encoder class.
  292. * The private internal vendored copy of ``urllib.parse.urlsplit()`` now strips
  293. ``'\r'``, ``'\n'``, and ``'\t'`` (see :cve:`2022-0391` and :bpo:`43882`).
  294. This is to protect projects that may be incorrectly using the internal
  295. ``url_has_allowed_host_and_scheme()`` function, instead of using one of the
  296. documented functions for handling URL redirects. The Django functions were
  297. not affected.
  298. * The new :func:`django.utils.http.content_disposition_header` function returns
  299. a ``Content-Disposition`` HTTP header value as specified by :rfc:`6266`.
  300. Validators
  301. ~~~~~~~~~~
  302. * The list of common passwords used by ``CommonPasswordValidator`` is updated
  303. to the most recent version.
  304. .. _backwards-incompatible-4.2:
  305. Backwards incompatible changes in 4.2
  306. =====================================
  307. Database backend API
  308. --------------------
  309. This section describes changes that may be needed in third-party database
  310. backends.
  311. * ``DatabaseFeatures.allows_group_by_pk`` is removed as it only remained to
  312. accommodate a MySQL extension that has been supplanted by proper functional
  313. dependency detection in MySQL 5.7.15. Note that
  314. ``DatabaseFeatures.allows_group_by_selected_pks`` is still supported and
  315. should be enabled if your backend supports functional dependency detection in
  316. ``GROUP BY`` clauses as specified by the ``SQL:1999`` standard.
  317. Dropped support for MariaDB 10.3
  318. --------------------------------
  319. Upstream support for MariaDB 10.3 ends in May 2023. Django 4.2 supports MariaDB
  320. 10.4 and higher.
  321. Dropped support for MySQL 5.7
  322. -----------------------------
  323. Upstream support for MySQL 5.7 ends in October 2023. Django 4.2 supports MySQL
  324. 8 and higher.
  325. Dropped support for PostgreSQL 11
  326. ---------------------------------
  327. Upstream support for PostgreSQL 11 ends in November 2023. Django 4.2 supports
  328. PostgreSQL 12 and higher.
  329. Setting ``update_fields`` in ``Model.save()`` may now be required
  330. -----------------------------------------------------------------
  331. In order to avoid updating unnecessary columns,
  332. :meth:`.QuerySet.update_or_create` now passes ``update_fields`` to the
  333. :meth:`Model.save() <django.db.models.Model.save>` calls. As a consequence, any
  334. fields modified in the custom ``save()`` methods should be added to the
  335. ``update_fields`` keyword argument before calling ``super()``. See
  336. :ref:`overriding-model-methods` for more details.
  337. Miscellaneous
  338. -------------
  339. * The undocumented ``SimpleTemplateResponse.rendering_attrs`` and
  340. ``TemplateResponse.rendering_attrs`` are renamed to ``non_picklable_attrs``.
  341. * The undocumented ``django.http.multipartparser.parse_header()`` function is
  342. removed. Use ``django.utils.http.parse_header_parameters()`` instead.
  343. * :ttag:`{% blocktranslate asvar … %}<blocktranslate>` result is now marked as
  344. safe for (HTML) output purposes.
  345. * The ``autofocus`` HTML attribute in the admin search box is removed as it can
  346. be confusing for screen readers.
  347. * The :option:`makemigrations --check` option no longer creates missing
  348. migration files.
  349. * The ``alias`` argument for :meth:`.Expression.get_group_by_cols` is removed.
  350. * The minimum supported version of ``sqlparse`` is increased from 0.2.2 to
  351. 0.3.1.
  352. * The undocumented ``negated`` parameter of the
  353. :class:`~django.db.models.Exists` expression is removed.
  354. * The ``is_summary`` argument of the undocumented ``Query.add_annotation()``
  355. method is removed.
  356. * The minimum supported version of SQLite is increased from 3.9.0 to 3.21.0.
  357. * :djadmin:`inspectdb` now uses ``display_size`` from
  358. ``DatabaseIntrospection.get_table_description()`` rather than
  359. ``internal_size`` for ``CharField``.
  360. * The minimum supported version of ``asgiref`` is increased from 3.5.2 to
  361. 3.6.0.
  362. * :class:`~django.contrib.auth.forms.UserCreationForm` now rejects usernames
  363. that differ only in case. If you need the previous behavior, use
  364. :class:`~django.contrib.auth.forms.BaseUserCreationForm` instead.
  365. * The minimum supported version of ``mysqlclient`` is increased from 1.4.0 to
  366. 1.4.3.
  367. * The minimum supported version of ``argon2-cffi`` is increased from 19.1.0 to
  368. 19.2.0.
  369. * The minimum supported version of ``Pillow`` is increased from 6.2.0 to 6.2.1.
  370. * The minimum supported version of ``jinja2`` is increased from 2.9.2 to
  371. 2.11.0.
  372. * The minimum supported version of `redis-py`_ is increased from 3.0.0 to
  373. 3.4.0.
  374. .. _`redis-py`: https://pypi.org/project/redis/
  375. * Manually instantiated ``WSGIRequest`` objects must be provided a file-like
  376. object for ``wsgi.input``. Previously, Django was more lax than the expected
  377. behavior as specified by the WSGI specification.
  378. * Support for ``PROJ`` < 5 is removed.
  379. .. _deprecated-features-4.2:
  380. Features deprecated in 4.2
  381. ==========================
  382. ``index_together`` option is deprecated in favor of ``indexes``
  383. ---------------------------------------------------------------
  384. The :attr:`Meta.index_together <django.db.models.Options.index_together>`
  385. option is deprecated in favor of the :attr:`~django.db.models.Options.indexes`
  386. option.
  387. Migrating existing ``index_together`` should be handled as a migration. For
  388. example::
  389. class Author(models.Model):
  390. rank = models.IntegerField()
  391. name = models.CharField(max_length=30)
  392. class Meta:
  393. index_together = [["rank", "name"]]
  394. Should become::
  395. class Author(models.Model):
  396. rank = models.IntegerField()
  397. name = models.CharField(max_length=30)
  398. class Meta:
  399. indexes = [models.Index(fields=["rank", "name"])]
  400. Running the :djadmin:`makemigrations` command will generate a migration
  401. containing a :class:`~django.db.migrations.operations.RenameIndex` operation
  402. which will rename the existing index.
  403. The ``AlterIndexTogether`` migration operation is now officially supported only
  404. for pre-Django 4.2 migration files. For backward compatibility reasons, it's
  405. still part of the public API, and there's no plan to deprecate or remove it,
  406. but it should not be used for new migrations. Use
  407. :class:`~django.db.migrations.operations.AddIndex` and
  408. :class:`~django.db.migrations.operations.RemoveIndex` operations instead.
  409. Passing encoded JSON string literals to ``JSONField`` is deprecated
  410. -------------------------------------------------------------------
  411. ``JSONField`` and its associated lookups and aggregates use to allow passing
  412. JSON encoded string literals which caused ambiguity on whether string literals
  413. were already encoded from database backend's perspective.
  414. During the deprecation period string literals will be attempted to be JSON
  415. decoded and a warning will be emitted on success that points at passing
  416. non-encoded forms instead.
  417. Code that use to pass JSON encoded string literals::
  418. Document.objects.bulk_create(
  419. Document(data=Value("null")),
  420. Document(data=Value("[]")),
  421. Document(data=Value('"foo-bar"')),
  422. )
  423. Document.objects.annotate(
  424. JSONBAgg("field", default=Value('[]')),
  425. )
  426. Should become::
  427. Document.objects.bulk_create(
  428. Document(data=Value(None, JSONField())),
  429. Document(data=[]),
  430. Document(data="foo-bar"),
  431. )
  432. Document.objects.annotate(
  433. JSONBAgg("field", default=[]),
  434. )
  435. From Django 5.1+ string literals will be implicitly interpreted as JSON string
  436. literals.
  437. Miscellaneous
  438. -------------
  439. * The ``BaseUserManager.make_random_password()`` method is deprecated. See
  440. `recipes and best practices
  441. <https://docs.python.org/3/library/secrets.html#recipes-and-best-practices>`_
  442. for using Python's :py:mod:`secrets` module to generate passwords.
  443. * The ``length_is`` template filter is deprecated in favor of :tfilter:`length`
  444. and the ``==`` operator within an :ttag:`{% if %}<if>` tag. For example
  445. .. code-block:: html+django
  446. {% if value|length == 4 %}…{% endif %}
  447. {% if value|length == 4 %}True{% else %}False{% endif %}
  448. instead of:
  449. .. code-block:: html+django
  450. {% if value|length_is:4 %}…{% endif %}
  451. {{ value|length_is:4 }}
  452. * ``django.contrib.auth.hashers.SHA1PasswordHasher``,
  453. ``django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher``, and
  454. ``django.contrib.auth.hashers.UnsaltedMD5PasswordHasher`` are deprecated.
  455. * ``django.contrib.postgres.fields.CICharField`` is deprecated in favor of
  456. ``CharField(db_collation="…")`` with a case-insensitive non-deterministic
  457. collation.
  458. * ``django.contrib.postgres.fields.CIEmailField`` is deprecated in favor of
  459. ``EmailField(db_collation="…")`` with a case-insensitive non-deterministic
  460. collation.
  461. * ``django.contrib.postgres.fields.CITextField`` is deprecated in favor of
  462. ``TextField(db_collation="…")`` with a case-insensitive non-deterministic
  463. collation.
  464. * ``django.contrib.postgres.fields.CIText`` mixin is deprecated.
  465. * The ``map_height`` and ``map_width`` attributes of ``BaseGeometryWidget`` are
  466. deprecated, use CSS to size map widgets instead.
  467. * ``SimpleTestCase.assertFormsetError()`` is deprecated in favor of
  468. ``assertFormSetError()``.
  469. * ``TransactionTestCase.assertQuerysetEqual()`` is deprecated in favor of
  470. ``assertQuerySetEqual()``.
  471. * Passing positional arguments to ``Signer`` and ``TimestampSigner`` is
  472. deprecated in favor of keyword-only arguments.
  473. * The ``DEFAULT_FILE_STORAGE`` setting is deprecated in favor of
  474. ``STORAGES["default"]``.
  475. * The ``STATICFILES_STORAGE`` setting is deprecated in favor of
  476. ``STORAGES["staticfiles"]``.
  477. * The ``django.core.files.storage.get_storage_class()`` function is deprecated.