deprecation.txt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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 runner 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. ``django.contrib.auth.context_processors.PermWrapper`` and
  129. ``django.contrib.auth.context_processors.PermLookupDict``, respectively.
  130. * The :setting:`MEDIA_URL` or :setting:`STATIC_URL` settings will be
  131. required to end with a trailing slash to ensure there is a consistent
  132. way to combine paths in templates.
  133. * ``django.db.models.fields.URLField.verify_exists`` will be removed. The
  134. feature was deprecated in 1.3.1 due to intractable security and
  135. performance issues and will follow a slightly accelerated deprecation
  136. timeframe.
  137. * Translations located under the so-called *project path* will be ignored during
  138. the translation building process performed at runtime. The
  139. :setting:`LOCALE_PATHS` setting can be used for the same task by including the
  140. filesystem path to a ``locale`` directory containing non-app-specific
  141. translations in its value.
  142. * The Markup contrib app will no longer support versions of Python-Markdown
  143. library earlier than 2.1. An accelerated timeline was used as this was
  144. a security related deprecation.
  145. * The ``CACHE_BACKEND`` setting will be removed. The cache backend(s) should be
  146. specified in the :setting:`CACHES` setting.
  147. 1.6
  148. ---
  149. See the :doc:`Django 1.4 release notes</releases/1.4>` for more details on
  150. these changes.
  151. * ``django.contrib.databrowse`` will be removed.
  152. * ``django.contrib.localflavor`` will be removed following an accelerated
  153. deprecation.
  154. * ``django.contrib.markup`` will be removed following an accelerated
  155. deprecation.
  156. * The compatibility modules ``django.utils.copycompat`` and
  157. ``django.utils.hashcompat`` as well as the functions
  158. ``django.utils.itercompat.all`` and ``django.utils.itercompat.any`` will
  159. be removed. The Python builtin versions should be used instead.
  160. * The ``csrf_response_exempt`` and ``csrf_view_exempt`` decorators will
  161. be removed. Since 1.4 ``csrf_response_exempt`` has been a no-op (it
  162. returns the same function), and ``csrf_view_exempt`` has been a
  163. synonym for ``django.views.decorators.csrf.csrf_exempt``, which should
  164. be used to replace it.
  165. * The ``django.core.cache.backends.memcached.CacheClass`` backend
  166. was split into two in Django 1.3 in order to introduce support for
  167. PyLibMC. The historical ``CacheClass`` will be removed in favor of
  168. ``django.core.cache.backends.memcached.MemcachedCache``.
  169. * The UK-prefixed objects of ``django.contrib.localflavor.uk`` will only
  170. be accessible through their GB-prefixed names (GB is the correct
  171. ISO 3166 code for United Kingdom).
  172. * The ``IGNORABLE_404_STARTS`` and ``IGNORABLE_404_ENDS`` settings have been
  173. superseded by :setting:`IGNORABLE_404_URLS` in the 1.4 release. They will be
  174. removed.
  175. * The :doc:`form wizard </ref/contrib/formtools/form-wizard>` has been
  176. refactored to use class-based views with pluggable backends in 1.4.
  177. The previous implementation will be removed.
  178. * Legacy ways of calling
  179. :func:`~django.views.decorators.cache.cache_page` will be removed.
  180. * The backward-compatibility shim to automatically add a debug-false
  181. filter to the ``'mail_admins'`` logging handler will be removed. The
  182. :setting:`LOGGING` setting should include this filter explicitly if
  183. it is desired.
  184. * The builtin truncation functions ``django.utils.text.truncate_words()``
  185. and ``django.utils.text.truncate_html_words()`` will be removed in
  186. favor of the ``django.utils.text.Truncator`` class.
  187. * The :class:`~django.contrib.gis.geoip.GeoIP` class was moved to
  188. :mod:`django.contrib.gis.geoip` in 1.4 -- the shortcut in
  189. :mod:`django.contrib.gis.utils` will be removed.
  190. * ``django.conf.urls.defaults`` will be removed. The functions
  191. :func:`~django.conf.urls.include`, :func:`~django.conf.urls.patterns` and
  192. :func:`~django.conf.urls.url` plus :data:`~django.conf.urls.handler404`,
  193. :data:`~django.conf.urls.handler500`, are now available through
  194. :mod:`django.conf.urls` .
  195. * The functions ``setup_environ()`` and ``execute_manager()`` will be removed
  196. from :mod:`django.core.management`. This also means that the old (pre-1.4)
  197. style of :file:`manage.py` file will no longer work.
  198. * Setting the ``is_safe`` and ``needs_autoescape`` flags as attributes of
  199. template filter functions will no longer be supported.
  200. * The attribute ``HttpRequest.raw_post_data`` was renamed to ``HttpRequest.body``
  201. in 1.4. The backward compatibility will be removed --
  202. ``HttpRequest.raw_post_data`` will no longer work.
  203. * The value for the ``post_url_continue`` parameter in
  204. ``ModelAdmin.response_add()`` will have to be either ``None`` (to redirect
  205. to the newly created object's edit page) or a pre-formatted url. String
  206. formats, such as the previous default ``'../%s/'``, will not be accepted any
  207. more.
  208. 1.7
  209. ---
  210. See the :doc:`Django 1.5 release notes</releases/1.5>` for more details on
  211. these changes.
  212. * The module ``django.utils.simplejson`` will be removed. The standard library
  213. provides :mod:`json` which should be used instead.
  214. * The function ``django.utils.itercompat.product`` will be removed. The Python
  215. builtin version should be used instead.
  216. * Auto-correction of INSTALLED_APPS and TEMPLATE_DIRS settings when they are
  217. specified as a plain string instead of a tuple will be removed and raise an
  218. exception.
  219. * The ``mimetype`` argument to the ``__init__`` methods of
  220. :class:`~django.http.HttpResponse`,
  221. :class:`~django.template.response.SimpleTemplateResponse`, and
  222. :class:`~django.template.response.TemplateResponse`, will be removed.
  223. ``content_type`` should be used instead. This also applies to the
  224. :func:`~django.shortcuts.render_to_response` shortcut and
  225. the sitemap views, :func:`~django.contrib.sitemaps.views.index` and
  226. :func:`~django.contrib.sitemaps.views.sitemap`.
  227. * When :class:`~django.http.HttpResponse` is instantiated with an iterator,
  228. or when :attr:`~django.http.HttpResponse.content` is set to an iterator,
  229. that iterator will be immediately consumed.
  230. * The ``AUTH_PROFILE_MODULE`` setting, and the ``get_profile()`` method on
  231. the User model, will be removed.
  232. * The ``cleanup`` management command will be removed. It's replaced by
  233. ``clearsessions``.
  234. * The ``daily_cleanup.py`` script will be removed.
  235. * The ``depth`` keyword argument will be removed from
  236. :meth:`~django.db.models.query.QuerySet.select_related`.
  237. * The undocumented ``get_warnings_state()``/``restore_warnings_state()``
  238. functions from :mod:`django.test.utils` and the ``save_warnings_state()``/
  239. ``restore_warnings_state()``
  240. :ref:`django.test.*TestCase <django-testcase-subclasses>` methods are
  241. deprecated. Use the :class:`warnings.catch_warnings` context manager
  242. available starting with Python 2.6 instead.
  243. * The undocumented ``check_for_test_cookie`` method in
  244. :class:`~django.contrib.auth.forms.AuthenticationForm` will be removed
  245. following an accelerated deprecation. Users subclassing this form should
  246. remove calls to this method, and instead ensure that their auth related views
  247. are CSRF protected, which ensures that cookies are enabled.
  248. * The version of :func:`django.contrib.auth.views.password_reset_confirm` that
  249. supports base36 encoded user IDs
  250. (``django.contrib.auth.views.password_reset_confirm_uidb36``) will be
  251. removed. If your site has been running Django 1.6 for more than
  252. :setting:`PASSWORD_RESET_TIMEOUT_DAYS`, this change will have no effect. If
  253. not, then any password reset links generated before you upgrade to Django 1.7
  254. won't work after the upgrade.
  255. 1.8
  256. ---
  257. * ``django.contrib.comments`` will be removed.
  258. * The following transaction management APIs will be removed:
  259. - ``TransactionMiddleware``,
  260. - the decorators and context managers ``autocommit``, ``commit_on_success``,
  261. and ``commit_manually``, defined in ``django.db.transaction``,
  262. - the functions ``commit_unless_managed`` and ``rollback_unless_managed``,
  263. also defined in ``django.db.transaction``,
  264. - the ``TRANSACTIONS_MANAGED`` setting.
  265. Upgrade paths are described in the :ref:`transaction management docs
  266. <transactions-upgrading-from-1.5>`.
  267. * The :ttag:`cycle` and :ttag:`firstof` template tags will auto-escape their
  268. arguments. In 1.6 and 1.7, this behavior is provided by the version of these
  269. tags in the ``future`` template tag library.
  270. * The ``SEND_BROKEN_LINK_EMAILS`` setting will be removed. Add the
  271. :class:`django.middleware.common.BrokenLinkEmailsMiddleware` middleware to
  272. your :setting:`MIDDLEWARE_CLASSES` setting instead.
  273. * ``Model._meta.module_name`` was renamed to ``model_name``.
  274. * Remove the backward compatible shims introduced to rename ``get_query_set``
  275. and similar queryset methods. This affects the following classes:
  276. ``BaseModelAdmin``, ``ChangeList``, ``BaseCommentNode``,
  277. ``GenericForeignKey``, ``Manager``, ``SingleRelatedObjectDescriptor`` and
  278. ``ReverseSingleRelatedObjectDescriptor``.
  279. * Remove the backward compatible shims introduced to rename the attributes
  280. ``ChangeList.root_query_set`` and ``ChangeList.query_set``.
  281. * ``django.conf.urls.shortcut`` and ``django.views.defaults.shortcut`` will be
  282. removed.
  283. * Support for the Python Imaging Library (PIL) module will be removed, as it
  284. no longer appears to be actively maintained & does not work on Python 3.
  285. You are advised to install `Pillow`_, which should be used instead.
  286. .. _`Pillow`: https://pypi.python.org/pypi/Pillow
  287. * The following private APIs will be removed:
  288. - ``django.db.backend``
  289. - ``django.db.close_connection()``
  290. - ``django.db.backends.creation.BaseDatabaseCreation.set_autocommit()``
  291. - ``django.db.transaction.is_managed()``
  292. - ``django.db.transaction.managed()``
  293. * ``django.forms.widgets.RadioInput`` will be removed in favor of
  294. ``django.forms.widgets.RadioChoiceInput``.
  295. * The module ``django.test.simple`` and the class
  296. ``django.test.simple.DjangoTestSuiteRunner`` will be removed. Instead use
  297. ``django.test.runner.DiscoverRunner``.
  298. * The module ``django.test._doctest`` will be removed. Instead use the doctest
  299. module from the Python standard library.
  300. * The ``CACHE_MIDDLEWARE_ANONYMOUS_ONLY`` setting will be removed.
  301. * Usage of the hard-coded *Hold down "Control", or "Command" on a Mac, to select
  302. more than one.* string to override or append to user-provided ``help_text`` in
  303. forms for ManyToMany model fields will not be performed by Django anymore
  304. either at the model or forms layer.
  305. * The ``Model._meta.get_(add|change|delete)_permission`` methods will
  306. be removed.
  307. 1.9
  308. ---
  309. * ``django.utils.dictconfig`` will be removed.
  310. * ``django.utils.unittest`` will be removed.
  311. * The ``syncdb`` command will be removed.
  312. * ``django.db.models.signals.pre_syncdb`` and
  313. ``django.db.models.signals.post_syncdb`` will be removed, and
  314. ``django.db.models.signals.pre_migrate`` and
  315. ``django.db.models.signals.post_migrate`` will lose their
  316. ``create_models`` and ``created_models`` arguments.
  317. * ``allow_syncdb`` on database routers will no longer automatically become
  318. ``allow_migrate``.
  319. 2.0
  320. ---
  321. * ``django.views.defaults.shortcut()``. This function has been moved
  322. to ``django.contrib.contenttypes.views.shortcut()`` as part of the
  323. goal of removing all ``django.contrib`` references from the core
  324. Django codebase. The old shortcut will be removed in the 2.0
  325. release.
  326. * ``ssi`` and ``url`` template tags will be removed from the ``future`` template
  327. tag library (used during the 1.3/1.4 deprecation period).