deprecation.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. ===========================
  2. Django Deprecation Timeline
  3. ===========================
  4. This document outlines when various pieces of Django will be removed or altered
  5. in a backward incompatible way, following their deprecation, as per the
  6. :ref:`deprecation policy <internal-release-deprecation-policy>`. More details
  7. about each item can often be found in the release notes of two versions prior.
  8. 1.4
  9. ---
  10. See the :doc:`Django 1.2 release notes</releases/1.2>` for more details on
  11. these changes.
  12. * ``CsrfResponseMiddleware`` and ``CsrfMiddleware`` will be removed. Use
  13. the {% csrf_token %} template tag inside forms to enable CSRF
  14. protection. ``CsrfViewMiddleware`` remains and is enabled by default.
  15. * The old imports for CSRF functionality (``django.contrib.csrf.*``),
  16. which moved to core in 1.2, will be removed.
  17. * The :mod:`django.contrib.gis.db.backend` module will be removed in favor
  18. of the specific backends.
  19. * ``SMTPConnection`` will be removed in favor of a generic E-mail backend API.
  20. * The many to many SQL generation functions on the database backends
  21. will be removed.
  22. * The ability to use the ``DATABASE_*`` family of top-level settings to
  23. define database connections will be removed.
  24. * The ability to use shorthand notation to specify a database backend
  25. (i.e., ``sqlite3`` instead of ``django.db.backends.sqlite3``) will be
  26. removed.
  27. * The ``get_db_prep_save``, ``get_db_prep_value`` and
  28. ``get_db_prep_lookup`` methods will have to support multiple databases.
  29. * The ``Message`` model (in ``django.contrib.auth``), its related
  30. manager in the ``User`` model (``user.message_set``), and the
  31. associated methods (``user.message_set.create()`` and
  32. ``user.get_and_delete_messages()``), will be removed. The
  33. :doc:`messages framework </ref/contrib/messages>` should be used
  34. instead. The related ``messages`` variable returned by the
  35. auth context processor will also be removed. Note that this
  36. means that the admin application will depend on the messages
  37. context processor.
  38. * Authentication backends will need to support the ``obj`` parameter for
  39. permission checking. The ``supports_object_permissions`` attribute
  40. will no longer be checked and can be removed from custom backends.
  41. * Authentication backends will need to support the ``AnonymousUser`` class
  42. being passed to all methods dealing with permissions. The
  43. ``supports_anonymous_user`` variable will no longer be checked and can be
  44. removed from custom backends.
  45. * The ability to specify a callable template loader rather than a
  46. ``Loader`` class will be removed, as will the ``load_template_source``
  47. functions that are included with the built in template loaders for
  48. backwards compatibility.
  49. * ``django.utils.translation.get_date_formats()`` and
  50. ``django.utils.translation.get_partial_date_formats()``. These functions
  51. will be removed; use the locale-aware
  52. ``django.utils.formats.get_format()`` to get the appropriate formats.
  53. * In ``django.forms.fields``, the constants: ``DEFAULT_DATE_INPUT_FORMATS``,
  54. ``DEFAULT_TIME_INPUT_FORMATS`` and
  55. ``DEFAULT_DATETIME_INPUT_FORMATS`` will be removed. Use
  56. ``django.utils.formats.get_format()`` to get the appropriate
  57. formats.
  58. * The ability to use a function-based test runners will be removed,
  59. along with the ``django.test.simple.run_tests()`` test runner.
  60. * The ``views.feed()`` view and ``feeds.Feed`` class in
  61. ``django.contrib.syndication`` will be removed. The class-based view
  62. ``views.Feed`` should be used instead.
  63. * ``django.core.context_processors.auth``. This release will
  64. remove the old method in favor of the new method in
  65. ``django.contrib.auth.context_processors.auth``.
  66. * The ``postgresql`` database backend will be removed, use the
  67. ``postgresql_psycopg2`` backend instead.
  68. * The ``no`` language code will be removed and has been replaced by the
  69. ``nb`` language code.
  70. * Authentication backends will need to define the boolean attribute
  71. ``supports_inactive_user`` until version 1.5 when it will be assumed that
  72. all backends will handle inactive users.
  73. * ``django.db.models.fields.XMLField`` will be removed. This was
  74. deprecated as part of the 1.3 release. An accelerated deprecation
  75. schedule has been used because the field hasn't performed any role
  76. beyond that of a simple ``TextField`` since the removal of oldforms.
  77. All uses of ``XMLField`` can be replaced with ``TextField``.
  78. * The undocumented ``mixin`` parameter to the ``open()`` method of
  79. ``django.core.files.storage.Storage`` (and subclasses) will be removed.
  80. 1.5
  81. ---
  82. See the :doc:`Django 1.3 release notes</releases/1.3>` for more details on
  83. these changes.
  84. * Starting Django without a :setting:`SECRET_KEY` will result in an exception
  85. rather than a `DeprecationWarning`. (This is accelerated from the usual
  86. deprecation path; see the :doc:`Django 1.4 release notes</releases/1.4>`.)
  87. * The ``mod_python`` request handler will be removed. The ``mod_wsgi``
  88. handler should be used instead.
  89. * The ``template`` attribute on :class:`~django.test.client.Response`
  90. objects returned by the :ref:`test client <test-client>` will be removed.
  91. The :attr:`~django.test.client.Response.templates` attribute should be
  92. used instead.
  93. * The :class:`~django.test.simple.DjangoTestRunner` will be removed.
  94. Instead use a unittest-native class. The features of the
  95. :class:`django.test.simple.DjangoTestRunner` (including fail-fast and
  96. Ctrl-C test termination) can currently be provided by the unittest-native
  97. :class:`TextTestRunner`.
  98. * The undocumented function
  99. :func:`django.contrib.formtools.utils.security_hash` will be removed,
  100. instead use :func:`django.contrib.formtools.utils.form_hmac`
  101. * The function-based generic view modules will be removed in favor of their
  102. class-based equivalents, outlined :doc:`here
  103. </topics/generic-views-migration>`:
  104. * The :class:`~django.core.servers.basehttp.AdminMediaHandler` will be
  105. removed. In its place use
  106. :class:`~django.contrib.staticfiles.handlers.StaticFilesHandler`.
  107. * The :ttag:`url` and :ttag:`ssi` template tags will be
  108. modified so that the first argument to each tag is a
  109. template variable, not an implied string. Until then, the new-style
  110. behavior is provided in the ``future`` template tag library.
  111. * The :djadmin:`reset` and :djadmin:`sqlreset` management commands
  112. will be removed.
  113. * Authentication backends will need to support an inactive user
  114. being passed to all methods dealing with permissions.
  115. The ``supports_inactive_user`` attribute will no longer be checked
  116. and can be removed from custom backends.
  117. * :meth:`~django.contrib.gis.geos.GEOSGeometry.transform` will raise
  118. a :class:`~django.contrib.gis.geos.GEOSException` when called
  119. on a geometry with no SRID value.
  120. * :class:`~django.http.CompatCookie` will be removed in favor of
  121. :class:`~django.http.SimpleCookie`.
  122. * :class:`django.core.context_processors.PermWrapper` and
  123. :class:`django.core.context_processors.PermLookupDict` will be removed in
  124. favor of the corresponding
  125. :class:`django.contrib.auth.context_processors.PermWrapper` and
  126. :class:`django.contrib.auth.context_processors.PermLookupDict`,
  127. respectively.
  128. * The :setting:`MEDIA_URL` or :setting:`STATIC_URL` settings will be
  129. required to end with a trailing slash to ensure there is a consistent
  130. way to combine paths in templates.
  131. * ``django.db.models.fields.URLField.verify_exists`` will be removed. The
  132. feature was deprecated in 1.3.1 due to intractable security and
  133. performance issues and will follow a slightly accelerated deprecation
  134. timeframe.
  135. * Translations located under the so-called *project path* will be ignored during
  136. the translation building process performed at runtime. The
  137. :setting:`LOCALE_PATHS` setting can be used for the same task by including the
  138. filesystem path to a ``locale`` directory containing non-app-specific
  139. translations in its value.
  140. * The Markup contrib app will no longer support versions of Python-Markdown
  141. library earlier than 2.1. An accelerated timeline was used as this was
  142. a security related deprecation.
  143. 1.6
  144. ---
  145. See the :doc:`Django 1.4 release notes</releases/1.4>` for more details on
  146. these changes.
  147. * The compatibility modules ``django.utils.copycompat`` and
  148. ``django.utils.hashcompat`` as well as the functions
  149. ``django.utils.itercompat.all`` and ``django.utils.itercompat.any`` will
  150. be removed. The Python builtin versions should be used instead.
  151. * The :func:`~django.views.decorators.csrf.csrf_response_exempt` and
  152. :func:`~django.views.decorators.csrf.csrf_view_exempt` decorators will
  153. be removed. Since 1.4 ``csrf_response_exempt`` has been a no-op (it
  154. returns the same function), and ``csrf_view_exempt`` has been a
  155. synonym for ``django.views.decorators.csrf.csrf_exempt``, which should
  156. be used to replace it.
  157. * The :class:`~django.core.cache.backends.memcached.CacheClass` backend
  158. was split into two in Django 1.3 in order to introduce support for
  159. PyLibMC. The historical :class:`~django.core.cache.backends.memcached.CacheClass`
  160. will be removed in favor of :class:`~django.core.cache.backends.memcached.MemcachedCache`.
  161. * The UK-prefixed objects of ``django.contrib.localflavor.uk`` will only
  162. be accessible through their GB-prefixed names (GB is the correct
  163. ISO 3166 code for United Kingdom).
  164. * The :setting:`IGNORABLE_404_STARTS` and :setting:`IGNORABLE_404_ENDS`
  165. settings have been superseded by :setting:`IGNORABLE_404_URLS` in
  166. the 1.4 release. They will be removed.
  167. * The :doc:`form wizard </ref/contrib/formtools/form-wizard>` has been
  168. refactored to use class based views with pluggable backends in 1.4.
  169. The previous implementation will be removed.
  170. * Legacy ways of calling
  171. :func:`~django.views.decorators.cache.cache_page` will be removed.
  172. * The backward-compatibility shim to automatically add a debug-false
  173. filter to the ``'mail_admins'`` logging handler will be removed. The
  174. :setting:`LOGGING` setting should include this filter explicitly if
  175. it is desired.
  176. * The template tag
  177. :func:`django.contrib.admin.templatetags.adminmedia.admin_media_prefix`
  178. will be removed in favor of the generic static files handling.
  179. * The builtin truncation functions :func:`django.utils.text.truncate_words`
  180. and :func:`django.utils.text.truncate_html_words` will be removed in
  181. favor of the ``django.utils.text.Truncator`` class.
  182. * The :class:`~django.contrib.gis.geoip.GeoIP` class was moved to
  183. :mod:`django.contrib.gis.geoip` in 1.4 -- the shortcut in
  184. :mod:`django.contrib.gis.utils` will be removed.
  185. * ``django.conf.urls.defaults`` will be removed. The functions
  186. :func:`~django.conf.urls.include`, :func:`~django.conf.urls.patterns` and
  187. :func:`~django.conf.urls.url` plus :data:`~django.conf.urls.handler404`,
  188. :data:`~django.conf.urls.handler500`, are now available through
  189. :mod:`django.conf.urls` .
  190. * The Databrowse contrib module will be removed.
  191. * The functions :func:`~django.core.management.setup_environ` and
  192. :func:`~django.core.management.execute_manager` will be removed from
  193. :mod:`django.core.management`. This also means that the old (pre-1.4)
  194. style of :file:`manage.py` file will no longer work.
  195. * Setting the ``is_safe`` and ``needs_autoescape`` flags as attributes of
  196. template filter functions will no longer be supported.
  197. * The attribute ``HttpRequest.raw_post_data`` was renamed to ``HttpRequest.body``
  198. in 1.4. The backward compatibility will be removed --
  199. ``HttpRequest.raw_post_data`` will no longer work.
  200. 1.7
  201. ---
  202. See the :doc:`Django 1.5 release notes</releases/1.5>` for more details on
  203. these changes.
  204. * The function ``django.utils.itercompat.product`` will be removed. The Python
  205. builtin version should be used instead.
  206. 2.0
  207. ---
  208. * ``django.views.defaults.shortcut()``. This function has been moved
  209. to ``django.contrib.contenttypes.views.shortcut()`` as part of the
  210. goal of removing all ``django.contrib`` references from the core
  211. Django codebase. The old shortcut will be removed in the 2.0
  212. release.