deprecation.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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 ``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 Email 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 ``django.test.simple.DjangoTestRunner`` will be removed.
  94. Instead use a unittest-native class. The features of the
  95. ``django.test.simple.DjangoTestRunner`` (including fail-fast and
  96. Ctrl-C test termination) can currently be provided by the unittest-native
  97. :class:`~unittest.TextTestRunner`.
  98. * The undocumented function
  99. ``django.contrib.formtools.utils.security_hash`` will be removed,
  100. instead use ``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/class-based-views/index>`.
  104. * The ``django.core.servers.basehttp.AdminMediaHandler`` will be
  105. removed. In its place use
  106. ``django.contrib.staticfiles.handlers.StaticFilesHandler``.
  107. * The template tags library ``adminmedia`` and the template tag ``{%
  108. admin_media_prefix %}`` will be removed in favor of the generic static files
  109. handling. (This is faster than the usual deprecation path; see the
  110. :doc:`Django 1.4 release notes</releases/1.4>`.)
  111. * The :ttag:`url` and :ttag:`ssi` template tags will be
  112. modified so that the first argument to each tag is a template variable, not
  113. an implied string. In 1.4, this behavior is provided by a version of the tag
  114. in the ``future`` template tag library.
  115. * The ``reset`` and ``sqlreset`` management commands will be removed.
  116. * Authentication backends will need to support an inactive user
  117. being passed to all methods dealing with permissions.
  118. The ``supports_inactive_user`` attribute will no longer be checked
  119. and can be removed from custom backends.
  120. * :meth:`~django.contrib.gis.geos.GEOSGeometry.transform` will raise
  121. a :class:`~django.contrib.gis.geos.GEOSException` when called
  122. on a geometry with no SRID value.
  123. * ``django.http.CompatCookie`` will be removed in favor of
  124. ``django.http.SimpleCookie``.
  125. * ``django.core.context_processors.PermWrapper`` and
  126. ``django.core.context_processors.PermLookupDict`` will be removed in
  127. favor of the corresponding
  128. :class:`django.contrib.auth.context_processors.PermWrapper` and
  129. :class:`django.contrib.auth.context_processors.PermLookupDict`,
  130. respectively.
  131. * The :setting:`MEDIA_URL` or :setting:`STATIC_URL` settings will be
  132. required to end with a trailing slash to ensure there is a consistent
  133. way to combine paths in templates.
  134. * ``django.db.models.fields.URLField.verify_exists`` will be removed. The
  135. feature was deprecated in 1.3.1 due to intractable security and
  136. performance issues and will follow a slightly accelerated deprecation
  137. timeframe.
  138. * Translations located under the so-called *project path* will be ignored during
  139. the translation building process performed at runtime. The
  140. :setting:`LOCALE_PATHS` setting can be used for the same task by including the
  141. filesystem path to a ``locale`` directory containing non-app-specific
  142. translations in its value.
  143. * The Markup contrib app will no longer support versions of Python-Markdown
  144. library earlier than 2.1. An accelerated timeline was used as this was
  145. a security related deprecation.
  146. * The ``CACHE_BACKEND`` setting will be removed. The cache backend(s) should be
  147. specified in the :setting:`CACHES` setting.
  148. 1.6
  149. ---
  150. See the :doc:`Django 1.4 release notes</releases/1.4>` for more details on
  151. these changes.
  152. * ``django.contrib.databrowse`` will be removed.
  153. * ``django.contrib.localflavor`` will be removed following an accelerated
  154. deprecation.
  155. * ``django.contrib.markup`` will be removed following an accelerated
  156. deprecation.
  157. * The compatibility modules ``django.utils.copycompat`` and
  158. ``django.utils.hashcompat`` as well as the functions
  159. ``django.utils.itercompat.all`` and ``django.utils.itercompat.any`` will
  160. be removed. The Python builtin versions should be used instead.
  161. * The ``csrf_response_exempt`` and ``csrf_view_exempt`` decorators will
  162. be removed. Since 1.4 ``csrf_response_exempt`` has been a no-op (it
  163. returns the same function), and ``csrf_view_exempt`` has been a
  164. synonym for ``django.views.decorators.csrf.csrf_exempt``, which should
  165. be used to replace it.
  166. * The :class:`~django.core.cache.backends.memcached.CacheClass` backend
  167. was split into two in Django 1.3 in order to introduce support for
  168. PyLibMC. The historical :class:`~django.core.cache.backends.memcached.CacheClass`
  169. will be removed in favor of :class:`~django.core.cache.backends.memcached.MemcachedCache`.
  170. * The UK-prefixed objects of ``django.contrib.localflavor.uk`` will only
  171. be accessible through their GB-prefixed names (GB is the correct
  172. ISO 3166 code for United Kingdom).
  173. * The :setting:`IGNORABLE_404_STARTS` and :setting:`IGNORABLE_404_ENDS`
  174. settings have been superseded by :setting:`IGNORABLE_404_URLS` in
  175. the 1.4 release. They will be removed.
  176. * The :doc:`form wizard </ref/contrib/formtools/form-wizard>` has been
  177. refactored to use class-based views with pluggable backends in 1.4.
  178. The previous implementation will be removed.
  179. * Legacy ways of calling
  180. :func:`~django.views.decorators.cache.cache_page` will be removed.
  181. * The backward-compatibility shim to automatically add a debug-false
  182. filter to the ``'mail_admins'`` logging handler will be removed. The
  183. :setting:`LOGGING` setting should include this filter explicitly if
  184. it is desired.
  185. * The builtin truncation functions :func:`django.utils.text.truncate_words`
  186. and :func:`django.utils.text.truncate_html_words` will be removed in
  187. favor of the ``django.utils.text.Truncator`` class.
  188. * The :class:`~django.contrib.gis.geoip.GeoIP` class was moved to
  189. :mod:`django.contrib.gis.geoip` in 1.4 -- the shortcut in
  190. :mod:`django.contrib.gis.utils` will be removed.
  191. * ``django.conf.urls.defaults`` will be removed. The functions
  192. :func:`~django.conf.urls.include`, :func:`~django.conf.urls.patterns` and
  193. :func:`~django.conf.urls.url` plus :data:`~django.conf.urls.handler404`,
  194. :data:`~django.conf.urls.handler500`, are now available through
  195. :mod:`django.conf.urls` .
  196. * The functions :func:`~django.core.management.setup_environ` and
  197. :func:`~django.core.management.execute_manager` will be removed from
  198. :mod:`django.core.management`. This also means that the old (pre-1.4)
  199. style of :file:`manage.py` file will no longer work.
  200. * Setting the ``is_safe`` and ``needs_autoescape`` flags as attributes of
  201. template filter functions will no longer be supported.
  202. * The attribute ``HttpRequest.raw_post_data`` was renamed to ``HttpRequest.body``
  203. in 1.4. The backward compatibility will be removed --
  204. ``HttpRequest.raw_post_data`` will no longer work.
  205. * The value for the ``post_url_continue`` parameter in
  206. ``ModelAdmin.response_add()`` will have to be either ``None`` (to redirect
  207. to the newly created object's edit page) or a pre-formatted url. String
  208. formats, such as the previous default ``'../%s/'``, will not be accepted any
  209. more.
  210. 1.7
  211. ---
  212. See the :doc:`Django 1.5 release notes</releases/1.5>` for more details on
  213. these changes.
  214. * The module ``django.utils.simplejson`` will be removed. The standard library
  215. provides :mod:`json` which should be used instead.
  216. * The function ``django.utils.itercompat.product`` will be removed. The Python
  217. builtin version should be used instead.
  218. * Auto-correction of INSTALLED_APPS and TEMPLATE_DIRS settings when they are
  219. specified as a plain string instead of a tuple will be removed and raise an
  220. exception.
  221. * The ``mimetype`` argument to :class:`~django.http.HttpResponse` ``__init__``
  222. will be removed (``content_type`` should be used instead).
  223. * When :class:`~django.http.HttpResponse` is instantiated with an iterator,
  224. or when :attr:`~django.http.HttpResponse.content` is set to an iterator,
  225. that iterator will be immediately consumed.
  226. * The ``AUTH_PROFILE_MODULE`` setting, and the ``get_profile()`` method on
  227. the User model, will be removed.
  228. * The ``cleanup`` management command will be removed. It's replaced by
  229. ``clearsessions``.
  230. * The ``daily_cleanup.py`` script will be removed.
  231. * The ``depth`` keyword argument will be removed from
  232. :meth:`~django.db.models.query.QuerySet.select_related`.
  233. 2.0
  234. ---
  235. * ``django.views.defaults.shortcut()``. This function has been moved
  236. to ``django.contrib.contenttypes.views.shortcut()`` as part of the
  237. goal of removing all ``django.contrib`` references from the core
  238. Django codebase. The old shortcut will be removed in the 2.0
  239. release.
  240. * ``ssi`` and ``url`` template tags will be removed from the ``future`` template
  241. tag library (used during the 1.3/1.4 deprecation period).