deprecation.txt 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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.7
  9. ---
  10. See the :doc:`Django 1.5 release notes</releases/1.5>` for more details on
  11. these changes.
  12. * The module ``django.utils.simplejson`` will be removed. The standard library
  13. provides :mod:`json` which should be used instead.
  14. * The function ``django.utils.itercompat.product`` will be removed. The Python
  15. builtin version should be used instead.
  16. * Auto-correction of INSTALLED_APPS and TEMPLATE_DIRS settings when they are
  17. specified as a plain string instead of a tuple will be removed and raise an
  18. exception.
  19. * The ``mimetype`` argument to the ``__init__`` methods of
  20. :class:`~django.http.HttpResponse`,
  21. :class:`~django.template.response.SimpleTemplateResponse`, and
  22. :class:`~django.template.response.TemplateResponse`, will be removed.
  23. ``content_type`` should be used instead. This also applies to the
  24. :func:`~django.shortcuts.render_to_response` shortcut and
  25. the sitemap views, :func:`~django.contrib.sitemaps.views.index` and
  26. :func:`~django.contrib.sitemaps.views.sitemap`.
  27. * When :class:`~django.http.HttpResponse` is instantiated with an iterator,
  28. or when :attr:`~django.http.HttpResponse.content` is set to an iterator,
  29. that iterator will be immediately consumed.
  30. * The ``AUTH_PROFILE_MODULE`` setting, and the ``get_profile()`` method on
  31. the User model, will be removed.
  32. * The ``cleanup`` management command will be removed. It's replaced by
  33. ``clearsessions``.
  34. * The ``daily_cleanup.py`` script will be removed.
  35. * The ``depth`` keyword argument will be removed from
  36. :meth:`~django.db.models.query.QuerySet.select_related`.
  37. * The undocumented ``get_warnings_state()``/``restore_warnings_state()``
  38. functions from :mod:`django.test.utils` and the ``save_warnings_state()``/
  39. ``restore_warnings_state()``
  40. :ref:`django.test.*TestCase <django-testcase-subclasses>` methods are
  41. deprecated. Use the :class:`warnings.catch_warnings` context manager
  42. available starting with Python 2.6 instead.
  43. * The undocumented ``check_for_test_cookie`` method in
  44. :class:`~django.contrib.auth.forms.AuthenticationForm` will be removed
  45. following an accelerated deprecation. Users subclassing this form should
  46. remove calls to this method, and instead ensure that their auth related views
  47. are CSRF protected, which ensures that cookies are enabled.
  48. * The version of :func:`django.contrib.auth.views.password_reset_confirm` that
  49. supports base36 encoded user IDs
  50. (``django.contrib.auth.views.password_reset_confirm_uidb36``) will be
  51. removed. If your site has been running Django 1.6 for more than
  52. :setting:`PASSWORD_RESET_TIMEOUT_DAYS`, this change will have no effect. If
  53. not, then any password reset links generated before you upgrade to Django 1.7
  54. won't work after the upgrade.
  55. 1.8
  56. ---
  57. * ``django.contrib.comments`` will be removed.
  58. * The following transaction management APIs will be removed:
  59. - ``TransactionMiddleware``,
  60. - the decorators and context managers ``autocommit``, ``commit_on_success``,
  61. and ``commit_manually``, defined in ``django.db.transaction``,
  62. - the functions ``commit_unless_managed`` and ``rollback_unless_managed``,
  63. also defined in ``django.db.transaction``,
  64. - the ``TRANSACTIONS_MANAGED`` setting.
  65. Upgrade paths are described in the :ref:`transaction management docs
  66. <transactions-upgrading-from-1.5>`.
  67. * The :ttag:`cycle` and :ttag:`firstof` template tags will auto-escape their
  68. arguments. In 1.6 and 1.7, this behavior is provided by the version of these
  69. tags in the ``future`` template tag library.
  70. * The ``SEND_BROKEN_LINK_EMAILS`` setting will be removed. Add the
  71. :class:`django.middleware.common.BrokenLinkEmailsMiddleware` middleware to
  72. your :setting:`MIDDLEWARE_CLASSES` setting instead.
  73. * ``Model._meta.module_name`` was renamed to ``model_name``.
  74. * Remove the backward compatible shims introduced to rename ``get_query_set``
  75. and similar queryset methods. This affects the following classes:
  76. ``BaseModelAdmin``, ``ChangeList``, ``BaseCommentNode``,
  77. ``GenericForeignKey``, ``Manager``, ``SingleRelatedObjectDescriptor`` and
  78. ``ReverseSingleRelatedObjectDescriptor``.
  79. * Remove the backward compatible shims introduced to rename the attributes
  80. ``ChangeList.root_query_set`` and ``ChangeList.query_set``.
  81. * ``django.views.defaults.shortcut`` will be removed, as part of the
  82. goal of removing all ``django.contrib`` references from the core
  83. Django codebase. Instead use
  84. ``django.contrib.contenttypes.views.shortcut``. ``django.conf.urls.shortcut``
  85. will also be removed.
  86. * Support for the Python Imaging Library (PIL) module will be removed, as it
  87. no longer appears to be actively maintained & does not work on Python 3.
  88. You are advised to install `Pillow`_, which should be used instead.
  89. .. _`Pillow`: https://pypi.python.org/pypi/Pillow
  90. * The following private APIs will be removed:
  91. - ``django.db.backend``
  92. - ``django.db.close_connection()``
  93. - ``django.db.backends.creation.BaseDatabaseCreation.set_autocommit()``
  94. - ``django.db.transaction.is_managed()``
  95. - ``django.db.transaction.managed()``
  96. * ``django.forms.widgets.RadioInput`` will be removed in favor of
  97. ``django.forms.widgets.RadioChoiceInput``.
  98. * The module ``django.test.simple`` and the class
  99. ``django.test.simple.DjangoTestSuiteRunner`` will be removed. Instead use
  100. ``django.test.runner.DiscoverRunner``.
  101. * The module ``django.test._doctest`` will be removed. Instead use the doctest
  102. module from the Python standard library.
  103. * The ``CACHE_MIDDLEWARE_ANONYMOUS_ONLY`` setting will be removed.
  104. * Usage of the hard-coded *Hold down "Control", or "Command" on a Mac, to select
  105. more than one.* string to override or append to user-provided ``help_text`` in
  106. forms for ManyToMany model fields will not be performed by Django anymore
  107. either at the model or forms layer.
  108. * The ``Model._meta.get_(add|change|delete)_permission`` methods will
  109. be removed.
  110. * The session key ``django_language`` will no longer be read for backwards
  111. compatibility.
  112. * Geographic Sitemaps will be removed
  113. (``django.contrib.gis.sitemaps.views.index`` and
  114. ``django.contrib.gis.sitemaps.views.sitemap``).
  115. 1.9
  116. ---
  117. * ``django.utils.dictconfig`` will be removed.
  118. * ``django.utils.importlib`` will be removed.
  119. * ``django.utils.tzinfo`` will be removed.
  120. * ``django.utils.unittest`` will be removed.
  121. * The ``syncdb`` command will be removed.
  122. * ``django.db.models.signals.pre_syncdb`` and
  123. ``django.db.models.signals.post_syncdb`` will be removed.
  124. * ``allow_syncdb`` on database routers will no longer automatically become
  125. ``allow_migrate``.
  126. * All models will need to be defined inside an installed application or
  127. declare an explicit :attr:`~django.db.models.Options.app_label`.
  128. Furthermore, it won't be possible to import them before their application
  129. is loaded. In particular, it won't be possible to import models inside
  130. the root package of their application.
  131. * If models are organized in a package, Django will no longer look for
  132. :ref:`initial SQL data<initial-sql>` in ``myapp/models/sql/``. Move your
  133. custom SQL files to ``myapp/sql/``.
  134. * The model and form ``IPAddressField`` will be removed.
  135. * ``AppCommand.handle_app()`` will no longer be supported.
  136. * ``RequestSite`` will be located in ``django.contrib.sites.requests`` and
  137. ``get_current_site`` in ``django.contrib.sites.shortcuts``.
  138. * FastCGI support via the ``runfcgi`` management command will be
  139. removed. Please deploy your project using WSGI.
  140. * ``django.utils.datastructures.SortedDict`` will be removed. Use
  141. :class:`collections.OrderedDict` from the Python standard library instead.
  142. * ``ModelAdmin.declared_fieldsets`` will be removed.
  143. * Instances of ``util.py`` in the Django codebase have been renamed to
  144. ``utils.py`` in an effort to unify all util and utils references.
  145. The modules that provided backwards compatibility will be removed:
  146. * ``django.contrib.admin.util``
  147. * ``django.contrib.gis.db.backends.util``
  148. * ``django.db.backends.util``
  149. * ``django.forms.util``
  150. * ``ModelAdmin.get_formsets`` will be removed.
  151. * Remove the backward compatible shims introduced to rename the
  152. ``BaseMemcachedCache._get_memcache_timeout()`` method to
  153. ``get_backend_timeout()``.
  154. * The ``--natural`` and ``-n`` options for :djadmin:`dumpdata` will be removed.
  155. Use :djadminopt:`--natural-foreign` instead.
  156. * The ``use_natural_keys`` argument for ``serializers.serialize()`` will be
  157. removed. Use ``use_natural_foreign_keys`` instead.
  158. * ``django.forms.get_declared_fields`` will be removed.
  159. * The ability to use a ``SplitDateTimeWidget`` with ``DateTimeField`` will be
  160. removed.
  161. * The ``WSGIRequest.REQUEST`` property will be removed.
  162. * The class ``django.utils.datastructures.MergeDict`` will be removed.
  163. * The ``zh-cn`` and ``zh-tw`` language codes will be removed and have been
  164. replaced by the ``zh-hans`` and ``zh-hant`` language code respectively.
  165. * The internal ``django.utils.functional.memoize`` will be removed.
  166. * ``django.core.cache.get_cache`` will be removed. Add suitable entries
  167. to :setting:`CACHES` and use :data:`django.core.cache.caches` instead.
  168. * ``django.db.models.loading`` will be removed.
  169. * Passing callable arguments to querysets will no longer be possible.
  170. * ``BaseCommand.requires_model_validation`` will be removed in favor of
  171. ``requires_system_checks``. Admin validators will be replaced by admin
  172. checks.
  173. * ``ModelAdmin.validator`` will be removed in favor of the new ``checks``
  174. attribute.
  175. * ``django.db.backends.DatabaseValidation.validate_field`` will be removed in
  176. favor of the ``check_field`` method.
  177. 2.0
  178. ---
  179. * ``ssi`` and ``url`` template tags will be removed from the ``future`` template
  180. tag library (used during the 1.3/1.4 deprecation period).