2.1.txt 9.2 KB

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