2.1.txt 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. ============================================
  2. Django 2.1 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. Welcome to Django 2.1!
  5. These release notes cover the :ref:`new features <whats-new-2.1>`, as well as
  6. some :ref:`backwards incompatible changes <backwards-incompatible-2.1>` you'll
  7. want to be aware of when upgrading from Django 2.0 or earlier. We've
  8. :ref:`dropped some features<removed-features-2.1>` that have reached the end of
  9. their deprecation cycle, and we've :ref:`begun the deprecation process for some
  10. features <deprecated-features-2.1>`.
  11. See the :doc:`/howto/upgrade-version` guide if you're updating an existing
  12. project.
  13. Python compatibility
  14. ====================
  15. Django 2.1 supports Python 3.5, 3.6, and 3.7. Django 2.0 is the last version to
  16. support Python 3.4. We **highly recommend** and only officially support the
  17. latest release of each series.
  18. .. _whats-new-2.1:
  19. What's new in Django 2.1
  20. ========================
  21. Minor features
  22. --------------
  23. :mod:`django.contrib.admin`
  24. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. * :attr:`.ModelAdmin.search_fields` now accepts any lookup such as
  26. ``field__exact``.
  27. * jQuery is upgraded from version 2.2.3 to 3.2.1.
  28. * The new :meth:`.ModelAdmin.delete_queryset` method allows customizing the
  29. deletion process of the "delete selected objects" action.
  30. :mod:`django.contrib.admindocs`
  31. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32. * ...
  33. :mod:`django.contrib.auth`
  34. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. * :djadmin:`createsuperuser` now gives a prompt to allow bypassing the
  36. :setting:`AUTH_PASSWORD_VALIDATORS` checks.
  37. * :class:`~django.contrib.auth.forms.UserCreationForm` and
  38. :class:`~django.contrib.auth.forms.UserChangeForm` no longer need to be
  39. rewritten for a custom user model.
  40. :mod:`django.contrib.contenttypes`
  41. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42. * ...
  43. :mod:`django.contrib.gis`
  44. ~~~~~~~~~~~~~~~~~~~~~~~~~
  45. * ...
  46. :mod:`django.contrib.messages`
  47. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  48. * ...
  49. :mod:`django.contrib.postgres`
  50. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  51. * ...
  52. :mod:`django.contrib.redirects`
  53. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  54. * ...
  55. :mod:`django.contrib.sessions`
  56. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  57. * ...
  58. :mod:`django.contrib.sitemaps`
  59. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  60. * ...
  61. :mod:`django.contrib.sites`
  62. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  63. * ...
  64. :mod:`django.contrib.staticfiles`
  65. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  66. * ...
  67. :mod:`django.contrib.syndication`
  68. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  69. * ...
  70. Cache
  71. ~~~~~
  72. * The :ref:`local-memory cache backend <local-memory-caching>` now uses a
  73. least-recently-used (LRU) culling strategy rather than a pseudo-random one.
  74. CSRF
  75. ~~~~
  76. * ...
  77. Database backends
  78. ~~~~~~~~~~~~~~~~~
  79. * ...
  80. Email
  81. ~~~~~
  82. * ...
  83. File Storage
  84. ~~~~~~~~~~~~
  85. * ...
  86. File Uploads
  87. ~~~~~~~~~~~~
  88. * ...
  89. Forms
  90. ~~~~~
  91. * ...
  92. Generic Views
  93. ~~~~~~~~~~~~~
  94. * ...
  95. Internationalization
  96. ~~~~~~~~~~~~~~~~~~~~
  97. * ...
  98. Management Commands
  99. ~~~~~~~~~~~~~~~~~~~
  100. * The new :option:`inspectdb --include-views` option allows creating models
  101. for database views.
  102. Migrations
  103. ~~~~~~~~~~
  104. * Added support for serialization of ``functools.partialmethod`` objects.
  105. Models
  106. ~~~~~~
  107. * Models can now use ``__init_subclass__()`` from :pep:`487`.
  108. * A ``BinaryField`` may now be set to ``editable=True`` if you wish to include
  109. it in model forms.
  110. * The new :class:`~django.db.models.functions.Replace` database function
  111. replaces strings in an expression.
  112. * The new :class:`~django.db.models.functions.TruncWeek` function truncates
  113. :class:`~django.db.models.DateField` and
  114. :class:`~django.db.models.DateTimeField` to the Monday of a week.
  115. * Query expressions can now be negated using a minus sign.
  116. Requests and Responses
  117. ~~~~~~~~~~~~~~~~~~~~~~
  118. * Added :meth:`.HttpRequest.get_full_path_info`.
  119. Serialization
  120. ~~~~~~~~~~~~~
  121. * ...
  122. Signals
  123. ~~~~~~~
  124. * ...
  125. Templates
  126. ~~~~~~~~~
  127. * ...
  128. Tests
  129. ~~~~~
  130. * ...
  131. URLs
  132. ~~~~
  133. * ...
  134. Validators
  135. ~~~~~~~~~~
  136. * ...
  137. .. _backwards-incompatible-2.1:
  138. Backwards incompatible changes in 2.1
  139. =====================================
  140. Database backend API
  141. --------------------
  142. * To adhere to :pep:`249`, exceptions where a database doesn't support a
  143. feature are changed from :exc:`NotImplementedError` to
  144. :exc:`django.db.NotSupportedError`.
  145. :mod:`django.contrib.gis`
  146. -------------------------
  147. * Support for SpatiaLite 4.0 is removed.
  148. Dropped support for MySQL 5.5
  149. -----------------------------
  150. The end of upstream support for MySQL 5.5 is December 2018. Django 2.1 supports
  151. MySQL 5.6 and higher.
  152. Dropped support for PostgreSQL 9.3
  153. ----------------------------------
  154. The end of upstream support for PostgreSQL 9.3 is September 2018. Django 2.1
  155. supports PostgreSQL 9.4 and higher.
  156. Miscellaneous
  157. -------------
  158. * The minimum supported version of ``mysqlclient`` is increased from 1.3.3 to
  159. 1.3.7.
  160. * The date format of ``Set-Cookie``'s ``Expires`` directive is changed to
  161. follow :rfc:`7231#section-7.1.1.1` instead of Netscape's cookie standard.
  162. Hyphens present in dates like ``Tue, 25-Dec-2018 22:26:13 GMT`` are removed.
  163. This change should be merely cosmetic except perhaps for antiquated browsers
  164. that don't parse the new format.
  165. * ``allowed_hosts`` is now a required argument of private API
  166. ``django.utils.http.is_safe_url()``.
  167. * The ``multiple`` attribute rendered by the
  168. :class:`~django.forms.SelectMultiple` widget now uses HTML5 boolean syntax
  169. rather than XHTML's ``multiple="multiple"``.
  170. * HTML rendered by form widgets no longer includes a closing slash on void
  171. elements, e.g. ``<br>``. This is incompatible within XHTML, although some
  172. widgets already used aspects of HTML5 such as boolean attributes.
  173. * The value of :class:`~django.forms.SelectDateWidget`'s empty options is
  174. changed from 0 to an empty string, which mainly may require some adjustments
  175. in tests that compare HTML.
  176. .. _deprecated-features-2.1:
  177. Features deprecated in 2.1
  178. ==========================
  179. Miscellaneous
  180. -------------
  181. * The ``ForceRHR`` GIS function is deprecated in favor of the new
  182. :class:`~django.contrib.gis.db.models.functions.ForcePolygonCW` function.
  183. * ``django.utils.http.cookie_date()`` is deprecated in favor of
  184. :func:`~django.utils.http.http_date`, which follows the format of the latest
  185. RFC.
  186. * ``{% load staticfiles %}`` and ``{% load admin_static %}`` are deprecated
  187. in favor of ``{% load static %}``, which works the same.
  188. * ``django.contrib.staticfiles.templatetags.static()`` is deprecated in favor
  189. of ``django.templatetags.static.static()``.
  190. .. _removed-features-2.1:
  191. Features removed in 2.1
  192. =======================
  193. These features have reached the end of their deprecation cycle and are removed
  194. in Django 2.1. See :ref:`deprecated-features-1.11` for details, including how
  195. to remove usage of these features.
  196. in Django 2.1. See :ref:`deprecated-features-1.11` and for details, including
  197. how to remove usage of these features.
  198. * ``contrib.auth.views.login()``, ``logout()``, ``password_change()``,
  199. ``password_change_done()``, ``password_reset()``, ``password_reset_done()``,
  200. ``password_reset_confirm()``, and ``password_reset_complete()`` are removed.
  201. * The ``extra_context`` parameter of ``contrib.auth.views.logout_then_login()``
  202. is removed.
  203. * ``django.test.runner.setup_databases()`` is removed.
  204. * ``django.utils.translation.string_concat()`` is removed.
  205. * ``django.core.cache.backends.memcached.PyLibMCCache`` no longer supports
  206. passing ``pylibmc`` behavior settings as top-level attributes of ``OPTIONS``.
  207. * The ``host`` parameter of ``django.utils.http.is_safe_url()`` is removed.
  208. * Silencing of exceptions raised while rendering the ``{% include %}`` template
  209. tag is removed.
  210. * ``DatabaseIntrospection.get_indexes()`` is removed.
  211. * The ``authenticate()`` method of authentication backends requires ``request``
  212. as the first positional argument.
  213. * The ``django.db.models.permalink()`` decorator is removed.
  214. * The ``USE_ETAGS`` setting is removed. ``CommonMiddleware`` and
  215. ``django.utils.cache.patch_response_headers()`` no longer set ETags.
  216. * The ``Model._meta.has_auto_field`` attribute is removed.
  217. * Support for regular expression groups with ``iLmsu#`` in ``url()`` is removed.
  218. * Support for ``Widget.render()`` methods without the ``renderer`` argument
  219. is removed.