2.1.txt 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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. * You can now :ref:`override the the default admin site
  31. <overriding-default-admin-site>`.
  32. * The new :attr:`.ModelAdmin.sortable_by` attribute and
  33. :meth:`.ModelAdmin.get_sortable_by` method allow limiting the columns that
  34. can be sorted in the change list page.
  35. :mod:`django.contrib.admindocs`
  36. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. * ...
  38. :mod:`django.contrib.auth`
  39. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  40. * :djadmin:`createsuperuser` now gives a prompt to allow bypassing the
  41. :setting:`AUTH_PASSWORD_VALIDATORS` checks.
  42. * :class:`~django.contrib.auth.forms.UserCreationForm` and
  43. :class:`~django.contrib.auth.forms.UserChangeForm` no longer need to be
  44. rewritten for a custom user model.
  45. :mod:`django.contrib.contenttypes`
  46. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47. * ...
  48. :mod:`django.contrib.gis`
  49. ~~~~~~~~~~~~~~~~~~~~~~~~~
  50. * ...
  51. :mod:`django.contrib.messages`
  52. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  53. * ...
  54. :mod:`django.contrib.postgres`
  55. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  56. * ...
  57. :mod:`django.contrib.redirects`
  58. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  59. * ...
  60. :mod:`django.contrib.sessions`
  61. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  62. * ...
  63. :mod:`django.contrib.sitemaps`
  64. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  65. * ...
  66. :mod:`django.contrib.sites`
  67. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68. * ...
  69. :mod:`django.contrib.staticfiles`
  70. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  71. * ...
  72. :mod:`django.contrib.syndication`
  73. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  74. * ...
  75. Cache
  76. ~~~~~
  77. * The :ref:`local-memory cache backend <local-memory-caching>` now uses a
  78. least-recently-used (LRU) culling strategy rather than a pseudo-random one.
  79. CSRF
  80. ~~~~
  81. * ...
  82. Database backends
  83. ~~~~~~~~~~~~~~~~~
  84. * ...
  85. Email
  86. ~~~~~
  87. * ...
  88. File Storage
  89. ~~~~~~~~~~~~
  90. * ...
  91. File Uploads
  92. ~~~~~~~~~~~~
  93. * ...
  94. Forms
  95. ~~~~~
  96. * ...
  97. Generic Views
  98. ~~~~~~~~~~~~~
  99. * ...
  100. Internationalization
  101. ~~~~~~~~~~~~~~~~~~~~
  102. * ...
  103. Management Commands
  104. ~~~~~~~~~~~~~~~~~~~
  105. * The new :option:`inspectdb --include-views` option allows creating models
  106. for database views.
  107. Migrations
  108. ~~~~~~~~~~
  109. * Added support for serialization of ``functools.partialmethod`` objects.
  110. Models
  111. ~~~~~~
  112. * Models can now use ``__init_subclass__()`` from :pep:`487`.
  113. * A ``BinaryField`` may now be set to ``editable=True`` if you wish to include
  114. it in model forms.
  115. * The new :class:`~django.db.models.functions.Replace` database function
  116. replaces strings in an expression.
  117. * The new :class:`~django.db.models.functions.TruncWeek` function truncates
  118. :class:`~django.db.models.DateField` and
  119. :class:`~django.db.models.DateTimeField` to the Monday of a week.
  120. * Query expressions can now be negated using a minus sign.
  121. * :meth:`.QuerySet.order_by` and :meth:`distinct(*fields) <.QuerySet.distinct>`
  122. now support using field transforms.
  123. Requests and Responses
  124. ~~~~~~~~~~~~~~~~~~~~~~
  125. * Added :meth:`.HttpRequest.get_full_path_info`.
  126. Serialization
  127. ~~~~~~~~~~~~~
  128. * ...
  129. Signals
  130. ~~~~~~~
  131. * ...
  132. Templates
  133. ~~~~~~~~~
  134. * The new :tfilter:`json_script` filter safely outputs a Python object as JSON,
  135. wrapped in a ``<script>`` tag, ready for use with JavaScript.
  136. Tests
  137. ~~~~~
  138. * Added test :class:`~django.test.Client` support for 307 and 308 redirects.
  139. * The test :class:`~django.test.Client` now serializes a request data
  140. dictionary as JSON if ``content_type='application/json'``. You can customize
  141. the JSON encoder with test client's ``json_encoder`` parameter.
  142. URLs
  143. ~~~~
  144. * ...
  145. Validators
  146. ~~~~~~~~~~
  147. * ...
  148. .. _backwards-incompatible-2.1:
  149. Backwards incompatible changes in 2.1
  150. =====================================
  151. Database backend API
  152. --------------------
  153. * To adhere to :pep:`249`, exceptions where a database doesn't support a
  154. feature are changed from :exc:`NotImplementedError` to
  155. :exc:`django.db.NotSupportedError`.
  156. * Renamed the ``allow_sliced_subqueries`` database feature flag to
  157. ``allow_sliced_subqueries_with_in``.
  158. * ``DatabaseOperations.distinct_sql()`` now requires an additional ``params``
  159. argument and returns a tuple of SQL and parameters instead of a SQL string.
  160. :mod:`django.contrib.gis`
  161. -------------------------
  162. * Support for SpatiaLite 4.0 is removed.
  163. Dropped support for MySQL 5.5
  164. -----------------------------
  165. The end of upstream support for MySQL 5.5 is December 2018. Django 2.1 supports
  166. MySQL 5.6 and higher.
  167. Dropped support for PostgreSQL 9.3
  168. ----------------------------------
  169. The end of upstream support for PostgreSQL 9.3 is September 2018. Django 2.1
  170. supports PostgreSQL 9.4 and higher.
  171. Miscellaneous
  172. -------------
  173. * The minimum supported version of ``mysqlclient`` is increased from 1.3.3 to
  174. 1.3.7.
  175. * The date format of ``Set-Cookie``'s ``Expires`` directive is changed to
  176. follow :rfc:`7231#section-7.1.1.1` instead of Netscape's cookie standard.
  177. Hyphens present in dates like ``Tue, 25-Dec-2018 22:26:13 GMT`` are removed.
  178. This change should be merely cosmetic except perhaps for antiquated browsers
  179. that don't parse the new format.
  180. * ``allowed_hosts`` is now a required argument of private API
  181. ``django.utils.http.is_safe_url()``.
  182. * The ``multiple`` attribute rendered by the
  183. :class:`~django.forms.SelectMultiple` widget now uses HTML5 boolean syntax
  184. rather than XHTML's ``multiple="multiple"``.
  185. * HTML rendered by form widgets no longer includes a closing slash on void
  186. elements, e.g. ``<br>``. This is incompatible within XHTML, although some
  187. widgets already used aspects of HTML5 such as boolean attributes.
  188. * The value of :class:`~django.forms.SelectDateWidget`'s empty options is
  189. changed from 0 to an empty string, which mainly may require some adjustments
  190. in tests that compare HTML.
  191. .. _deprecated-features-2.1:
  192. Features deprecated in 2.1
  193. ==========================
  194. Miscellaneous
  195. -------------
  196. * The ``ForceRHR`` GIS function is deprecated in favor of the new
  197. :class:`~django.contrib.gis.db.models.functions.ForcePolygonCW` function.
  198. * ``django.utils.http.cookie_date()`` is deprecated in favor of
  199. :func:`~django.utils.http.http_date`, which follows the format of the latest
  200. RFC.
  201. * ``{% load staticfiles %}`` and ``{% load admin_static %}`` are deprecated
  202. in favor of ``{% load static %}``, which works the same.
  203. * ``django.contrib.staticfiles.templatetags.static()`` is deprecated in favor
  204. of ``django.templatetags.static.static()``.
  205. .. _removed-features-2.1:
  206. Features removed in 2.1
  207. =======================
  208. These features have reached the end of their deprecation cycle and are removed
  209. in Django 2.1. See :ref:`deprecated-features-1.11` for details, including how
  210. to remove usage of these features.
  211. in Django 2.1. See :ref:`deprecated-features-1.11` and for details, including
  212. how to remove usage of these features.
  213. * ``contrib.auth.views.login()``, ``logout()``, ``password_change()``,
  214. ``password_change_done()``, ``password_reset()``, ``password_reset_done()``,
  215. ``password_reset_confirm()``, and ``password_reset_complete()`` are removed.
  216. * The ``extra_context`` parameter of ``contrib.auth.views.logout_then_login()``
  217. is removed.
  218. * ``django.test.runner.setup_databases()`` is removed.
  219. * ``django.utils.translation.string_concat()`` is removed.
  220. * ``django.core.cache.backends.memcached.PyLibMCCache`` no longer supports
  221. passing ``pylibmc`` behavior settings as top-level attributes of ``OPTIONS``.
  222. * The ``host`` parameter of ``django.utils.http.is_safe_url()`` is removed.
  223. * Silencing of exceptions raised while rendering the ``{% include %}`` template
  224. tag is removed.
  225. * ``DatabaseIntrospection.get_indexes()`` is removed.
  226. * The ``authenticate()`` method of authentication backends requires ``request``
  227. as the first positional argument.
  228. * The ``django.db.models.permalink()`` decorator is removed.
  229. * The ``USE_ETAGS`` setting is removed. ``CommonMiddleware`` and
  230. ``django.utils.cache.patch_response_headers()`` no longer set ETags.
  231. * The ``Model._meta.has_auto_field`` attribute is removed.
  232. * Support for regular expression groups with ``iLmsu#`` in ``url()`` is removed.
  233. * Support for ``Widget.render()`` methods without the ``renderer`` argument
  234. is removed.