3.0.txt 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. ============================================
  2. Django 3.0 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. *Expected December 2019*
  5. Welcome to Django 3.0!
  6. These release notes cover the :ref:`new features <whats-new-3.0>`, as well as
  7. some :ref:`backwards incompatible changes <backwards-incompatible-3.0>` you'll
  8. want to be aware of when upgrading from Django 2.2 or earlier. We've
  9. :ref:`dropped some features<removed-features-3.0>` that have reached the end of
  10. their deprecation cycle, and we've :ref:`begun the deprecation process for
  11. some features <deprecated-features-3.0>`.
  12. See the :doc:`/howto/upgrade-version` guide if you're updating an existing
  13. project.
  14. Python compatibility
  15. ====================
  16. Django 3.0 supports Python 3.6, 3.7, and 3.8. We **highly recommend** and only
  17. officially support the latest release of each series.
  18. The Django 2.2.x series is the last to support Python 3.5.
  19. Third-party library support for older version of Django
  20. =======================================================
  21. Following the release of Django 3.0, we suggest that third-party app authors
  22. drop support for all versions of Django prior to 2.2. At that time, you should
  23. be able to run your package's tests using ``python -Wd`` so that deprecation
  24. warnings appear. After making the deprecation warning fixes, your app should be
  25. compatible with Django 3.0.
  26. .. _whats-new-3.0:
  27. What's new in Django 3.0
  28. ========================
  29. Minor features
  30. --------------
  31. :mod:`django.contrib.admin`
  32. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  33. * ...
  34. :mod:`django.contrib.admindocs`
  35. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36. * ...
  37. :mod:`django.contrib.auth`
  38. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  39. * ...
  40. :mod:`django.contrib.contenttypes`
  41. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42. * ...
  43. :mod:`django.contrib.gis`
  44. ~~~~~~~~~~~~~~~~~~~~~~~~~
  45. * Allowed MySQL spatial lookup functions to operate on real geometries.
  46. Previous support was limited to bounding boxes.
  47. :mod:`django.contrib.messages`
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. * ...
  50. :mod:`django.contrib.postgres`
  51. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  52. * ...
  53. :mod:`django.contrib.redirects`
  54. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. * ...
  56. :mod:`django.contrib.sessions`
  57. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58. * ...
  59. :mod:`django.contrib.sitemaps`
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. * ...
  62. :mod:`django.contrib.sites`
  63. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64. * ...
  65. :mod:`django.contrib.staticfiles`
  66. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. * ...
  68. :mod:`django.contrib.syndication`
  69. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70. * ...
  71. Cache
  72. ~~~~~
  73. * ...
  74. CSRF
  75. ~~~~
  76. * ...
  77. Email
  78. ~~~~~
  79. * ...
  80. File Storage
  81. ~~~~~~~~~~~~
  82. * ...
  83. File Uploads
  84. ~~~~~~~~~~~~
  85. * ...
  86. Forms
  87. ~~~~~
  88. * ...
  89. Generic Views
  90. ~~~~~~~~~~~~~
  91. * ...
  92. Internationalization
  93. ~~~~~~~~~~~~~~~~~~~~
  94. * ...
  95. Management Commands
  96. ~~~~~~~~~~~~~~~~~~~
  97. * The new :option:`compilemessages --ignore` option allows ignoring specific
  98. directories when searching for ``.po`` files to compile.
  99. Migrations
  100. ~~~~~~~~~~
  101. * ...
  102. Models
  103. ~~~~~~
  104. * ...
  105. Requests and Responses
  106. ~~~~~~~~~~~~~~~~~~~~~~
  107. * ...
  108. Serialization
  109. ~~~~~~~~~~~~~
  110. * ...
  111. Signals
  112. ~~~~~~~
  113. * ...
  114. Templates
  115. ~~~~~~~~~
  116. * ...
  117. Tests
  118. ~~~~~
  119. * ...
  120. URLs
  121. ~~~~
  122. * ...
  123. Validators
  124. ~~~~~~~~~~
  125. * ...
  126. .. _backwards-incompatible-3.0:
  127. Backwards incompatible changes in 3.0
  128. =====================================
  129. Database backend API
  130. --------------------
  131. This section describes changes that may be needed in third-party database
  132. backends.
  133. * The second argument of ``DatabaseIntrospection.get_geometry_type()`` is now
  134. the row description instead of the column name.
  135. * ``DatabaseIntrospection.get_field_type()`` may no longer return tuples.
  136. * If the database can create foreign keys in the same SQL statement that adds a
  137. field, add ``SchemaEditor.sql_create_column_inline_fk`` with the appropriate
  138. SQL; otherwise, set ``DatabaseFeatures.can_create_inline_fk = False``.
  139. * ``DatabaseFeatures.can_return_id_from_insert`` and
  140. ``can_return_ids_from_bulk_insert`` are renamed to
  141. ``can_return_columns_from_insert`` and ``can_return_rows_from_bulk_insert``.
  142. :mod:`django.contrib.gis`
  143. -------------------------
  144. * Support for PostGIS 2.1 is removed.
  145. * Support for SpatiaLite 4.1 and 4.2 is removed.
  146. * Support for GDAL 1.11 and GEOS 3.4 is removed.
  147. Dropped support for PostgreSQL 9.4
  148. ----------------------------------
  149. Upstream support for PostgreSQL 9.4 ends in December 2019. Django 3.0 supports
  150. PostgreSQL 9.5 and higher.
  151. Dropped support for Oracle 12.1
  152. -------------------------------
  153. Upstream support for Oracle 12.1 ends in July 2021. Django 2.2 will be
  154. supported until April 2022. Django 3.0 officially supports Oracle 12.2 and 18c.
  155. Removed private Python 2 compatibility APIs
  156. -------------------------------------------
  157. While Python 2 support was removed in Django 2.0, some private APIs weren't
  158. removed from Django so that third party apps could continue using them until
  159. the Python 2 end-of-life.
  160. Since we expect apps to drop Python 2 compatibility when adding support for
  161. Django 3.0, we're removing these APIs at this time.
  162. * ``django.test.utils.str_prefix()`` - Strings don't have 'u' prefixes in
  163. Python 3.
  164. * ``django.test.utils.patch_logger()`` - Use
  165. :meth:`unittest.TestCase.assertLogs` instead.
  166. * ``django.utils.lru_cache.lru_cache()`` - Alias of
  167. :func:`functools.lru_cache`.
  168. * ``django.utils.decorators.available_attrs()`` - This function returns
  169. ``functools.WRAPPER_ASSIGNMENTS``.
  170. * ``django.utils.decorators.ContextDecorator`` - Alias of
  171. :class:`contextlib.ContextDecorator`.
  172. * ``django.utils._os.abspathu()`` - Alias of :func:`os.path.abspath`.
  173. * ``django.utils._os.upath()`` and ``npath()`` - These functions do nothing on
  174. Python 3.
  175. * ``django.utils.six`` - Remove usage of this vendored library or switch to
  176. `six <https://pypi.org/project/six/>`_.
  177. * ``django.utils.encoding.python_2_unicode_compatible()`` - Alias of
  178. ``six.python_2_unicode_compatible()``.
  179. * ``django.utils.functional.curry()`` - Use :func:`functools.partial` or
  180. :class:`functools.partialmethod`. See :commit:`5b1c389603a353625ae1603`.
  181. * ``django.utils.safestring.SafeBytes`` - Unused since Django 2.0.
  182. New default value for the ``FILE_UPLOAD_PERMISSIONS`` setting
  183. -------------------------------------------------------------
  184. In older versions, the :setting:`FILE_UPLOAD_PERMISSIONS` setting defaults to
  185. ``None``. With the default :setting:`FILE_UPLOAD_HANDLERS`, this results in
  186. uploaded files having different permissions depending on their size and which
  187. upload handler is used.
  188. ``FILE_UPLOAD_PERMISSION`` now defaults to ``0o644`` to avoid this
  189. inconsistency.
  190. Miscellaneous
  191. -------------
  192. * ``ContentType.__str__()`` now includes the model's ``app_label`` to
  193. disambiguate model's with the same name in different apps.
  194. .. _deprecated-features-3.0:
  195. Features deprecated in 3.0
  196. ==========================
  197. ``django.utils.encoding.force_text()`` and ``smart_text()``
  198. -----------------------------------------------------------
  199. The ``smart_text()`` and ``force_text()`` aliases (since Django 2.0) of
  200. ``smart_str()`` and ``force_str()`` are deprecated. Ignore this deprecation if
  201. your code supports Python 2 as the behavior of ``smart_str()`` and
  202. ``force_str()`` is different there.
  203. Miscellaneous
  204. -------------
  205. * ``django.utils.http.urlquote()``, ``urlquote_plus()``, ``urlunquote()``, and
  206. ``urlunquote_plus()`` are deprecated in favor of the functions that they're
  207. aliases for: :func:`urllib.parse.quote`, :func:`~urllib.parse.quote_plus`,
  208. :func:`~urllib.parse.unquote`, and :func:`~urllib.parse.unquote_plus`.
  209. * ``django.utils.translation.ugettext()``, ``ugettext_lazy()``,
  210. ``ugettext_noop()``, ``ungettext()``, and ``ungettext_lazy()`` are deprecated
  211. in favor of the functions that they're aliases for:
  212. :func:`django.utils.translation.gettext`,
  213. :func:`~django.utils.translation.gettext_lazy`,
  214. :func:`~django.utils.translation.gettext_noop`,
  215. :func:`~django.utils.translation.ngettext`, and
  216. :func:`~django.utils.translation.ngettext_lazy`.
  217. .. _removed-features-3.0:
  218. Features removed in 3.0
  219. =======================
  220. These features have reached the end of their deprecation cycle and are removed
  221. in Django 3.0.
  222. See :ref:`deprecated-features-2.0` for details on these changes, including how
  223. to remove usage of these features.
  224. * The ``django.db.backends.postgresql_psycopg2`` module is removed.
  225. * ``django.shortcuts.render_to_response()`` is removed.
  226. * The ``DEFAULT_CONTENT_TYPE`` setting is removed.
  227. * ``HttpRequest.xreadlines()`` is removed.
  228. * Support for the ``context`` argument of ``Field.from_db_value()`` and
  229. ``Expression.convert_value()`` is removed.
  230. * The ``field_name`` keyword argument of ``QuerySet.earliest()` and
  231. ``latest()`` is removed.
  232. See :ref:`deprecated-features-2.1` for details on these changes, including how
  233. to remove usage of these features.
  234. * The ``ForceRHR`` GIS function is removed.
  235. * ``django.utils.http.cookie_date()`` is removed.
  236. * The ``staticfiles`` and ``admin_static`` template tag libraries are removed.
  237. * ``django.contrib.staticfiles.templatetags.staticfiles.static()`` is removed.