1.9.txt 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. ============================================
  2. Django 1.9 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. Welcome to Django 1.9!
  5. These release notes cover the `new features`_, as well as some `backwards
  6. incompatible changes`_ you'll want to be aware of when upgrading from Django
  7. 1.8 or older versions. We've :ref:`dropped some features
  8. <deprecation-removed-in-1.9>` that have reached the end of their deprecation
  9. cycle, and we've `begun the deprecation process for some features`_.
  10. .. _`new features`: `What's new in Django 1.9`_
  11. .. _`backwards incompatible changes`: `Backwards incompatible changes in 1.9`_
  12. .. _`dropped some features`: `Features removed in 1.9`_
  13. .. _`begun the deprecation process for some features`: `Features deprecated in 1.9`_
  14. Python compatibility
  15. ====================
  16. Like Django 1.8, Django 1.9 requires Python 2.7 or above, though we
  17. **highly recommend** the latest minor release. We've dropped support for
  18. Python 3.2 and added support for Python 3.5.
  19. What's new in Django 1.9
  20. ========================
  21. ...
  22. Minor features
  23. ~~~~~~~~~~~~~~
  24. :mod:`django.contrib.admin`
  25. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  26. * Admin views now have ``model_admin`` or ``admin_site`` attributes.
  27. * The URL of the admin change view has been changed (was at
  28. ``/admin/<app>/<model>/<pk>/`` by default and is now at
  29. ``/admin/<app>/<model>/<pk>/change/``). This should not affect your
  30. application unless you have hardcoded admin URLs. In that case, replace those
  31. links by :ref:`reversing admin URLs <admin-reverse-urls>` instead. Note that
  32. the old URL still redirects to the new one for backwards compatibility, but
  33. it may be removed in a future version.
  34. * :meth:`ModelAdmin.get_list_select_related()
  35. <django.contrib.admin.ModelAdmin.get_list_select_related>` was added to allow
  36. changing the ``select_related()`` values used in the admin's changelist query
  37. based on the request.
  38. * The ``available_apps`` context variable, which lists the available
  39. applications for the current user, has been added to the
  40. :meth:`AdminSite.each_context() <django.contrib.admin.AdminSite.each_context>`
  41. method.
  42. :mod:`django.contrib.auth`
  43. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  44. * The default iteration count for the PBKDF2 password hasher has been increased
  45. by 20%. This backwards compatible change will not affect users who have
  46. subclassed ``django.contrib.auth.hashers.PBKDF2PasswordHasher`` to change the
  47. default value.
  48. * The ``BCryptSHA256PasswordHasher`` will now update passwords if its
  49. ``rounds`` attribute is changed.
  50. * ``AbstractBaseUser`` and ``BaseUserManager`` were moved to a new
  51. ``django.contrib.auth.base_user`` module so that they can be imported without
  52. including ``django.contrib.auth`` in :setting:`INSTALLED_APPS` (this raised
  53. a deprecation warning in older versions and is no longer supported in
  54. Django 1.9).
  55. :mod:`django.contrib.gis`
  56. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  57. * All ``GeoQuerySet`` methods have been deprecated and replaced by
  58. :doc:`equivalent database functions </ref/contrib/gis/functions>`. As soon
  59. as the legacy methods have been replaced in your code, you should even be
  60. able to remove the special ``GeoManager`` from your GIS-enabled classes.
  61. * The GDAL interface now supports instantiating file-based and in-memory
  62. :ref:`GDALRaster objects <raster-data-source-objects>` from raw data.
  63. Setters for raster properties such as projection or pixel values have
  64. been added.
  65. :mod:`django.contrib.messages`
  66. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  67. * ...
  68. :mod:`django.contrib.postgres`
  69. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  70. * Added :doc:`/ref/contrib/postgres/aggregates`.
  71. :mod:`django.contrib.redirects`
  72. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  73. * ...
  74. :mod:`django.contrib.sessions`
  75. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  76. * ...
  77. :mod:`django.contrib.sitemaps`
  78. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  79. * ...
  80. :mod:`django.contrib.sites`
  81. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  82. * ...
  83. :mod:`django.contrib.staticfiles`
  84. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  85. * ...
  86. :mod:`django.contrib.syndication`
  87. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  88. * ...
  89. Cache
  90. ^^^^^
  91. * ``django.core.cache.backends.base.BaseCache`` now has a ``get_or_set()``
  92. method.
  93. * :func:`django.views.decorators.cache.never_cache` now sends more persuasive
  94. headers (added ``no-cache, no-store, must-revalidate`` to ``Cache-Control``)
  95. to better prevent caching.
  96. Email
  97. ^^^^^
  98. * ...
  99. File Storage
  100. ^^^^^^^^^^^^
  101. * :meth:`Storage.get_valid_name()
  102. <django.core.files.storage.Storage.get_valid_name>` is now called when
  103. the :attr:`~django.db.models.FileField.upload_to` is a callable.
  104. File Uploads
  105. ^^^^^^^^^^^^
  106. * ...
  107. Forms
  108. ^^^^^
  109. * :class:`~django.forms.ModelForm` accepts the new ``Meta`` option
  110. ``field_classes`` to customize the type of the fields. See
  111. :ref:`modelforms-overriding-default-fields` for details.
  112. * You can now specify the order in which form fields are rendered with the
  113. :attr:`~django.forms.Form.field_order` attribute, the ``field_order``
  114. constructor argument , or the :meth:`~django.forms.Form.order_fields` method.
  115. Generic Views
  116. ^^^^^^^^^^^^^
  117. * Class based views generated using ``as_view()`` now have ``view_class``
  118. and ``view_initkwargs`` attributes.
  119. Internationalization
  120. ^^^^^^^^^^^^^^^^^^^^
  121. * The :func:`django.views.i18n.set_language` view now properly redirects to
  122. :ref:`translated URLs <url-internationalization>`, when available.
  123. * The :func:`django.views.i18n.javascript_catalog` view now works correctly
  124. if used multiple times with different configurations on the same page.
  125. * The :func:`django.utils.timezone.make_aware` function gained an ``is_dst``
  126. argument to help resolve ambiguous times during DST transitions.
  127. * You can now use locale variants supported by gettext. These are usually used
  128. for languages which can be written in different scripts, for example Latin
  129. and Cyrillic (e.g. ``be@latin``).
  130. Management Commands
  131. ^^^^^^^^^^^^^^^^^^^
  132. * The new :djadmin:`sendtestemail` command lets you send a test email to
  133. easily confirm that email sending through Django is working.
  134. * To increase the readability of the SQL code generated by
  135. :djadmin:`sqlmigrate`, the SQL code generated for each migration operation is
  136. preceded by the operation's description.
  137. * The :djadmin:`dumpdata` command output is now deterministically ordered.
  138. * The :djadmin:`createcachetable` command now has a ``--dry-run`` flag to
  139. print out the SQL rather than execute it.
  140. Models
  141. ^^^^^^
  142. * Database configuration gained a :setting:`TIME_ZONE <DATABASE-TIME_ZONE>`
  143. option for interacting with databases that store datetimes in local time and
  144. don't support time zones when :setting:`USE_TZ` is ``True``.
  145. * Added the :meth:`RelatedManager.set()
  146. <django.db.models.fields.related.RelatedManager.set()>` method to the related
  147. managers created by ``ForeignKey``, ``GenericForeignKey``, and
  148. ``ManyToManyField``.
  149. * Added the ``keep_parents`` parameter to :meth:`Model.delete()
  150. <django.db.models.Model.delete>` to allow deleting only a child's data in a
  151. model that uses multi-table inheritance.
  152. * Added a system check to prevent defining both ``Meta.ordering`` and
  153. ``order_with_respect_to`` on the same model.
  154. * :lookup:`Date and time <year>` lookups can be chained with other lookups
  155. (such as :lookup:`exact`, :lookup:`gt`, :lookup:`lt`, etc.). For example:
  156. ``Entry.objects.filter(pub_date__month__gt=6)``.
  157. * You can specify the ``output_field`` parameter of the
  158. :class:`~django.db.models.Avg` aggregate in order to aggregate over
  159. non-numeric columns, such as ``DurationField``.
  160. CSRF
  161. ^^^^
  162. * The request header's name used for CSRF authentication can be customized
  163. with :setting:`CSRF_HEADER_NAME`.
  164. Signals
  165. ^^^^^^^
  166. * ...
  167. Templates
  168. ^^^^^^^^^
  169. * Template tags created with the :meth:`~django.template.Library.simple_tag`
  170. helper can now store results in a template variable by using the ``as``
  171. argument.
  172. * Added a :meth:`Context.setdefault() <django.template.Context.setdefault>`
  173. method.
  174. * A warning will now be logged for missing context variables. These messages
  175. will be logged to the :ref:`django.template <django-template-logger>` logger.
  176. * The :ttag:`firstof` template tag supports storing the output in a variable
  177. using 'as'.
  178. * :meth:`Context.update() <django.template.Context.update>` can now be used as
  179. a context manager.
  180. * Django template loaders can now extend templates recursively.
  181. * The debug page template postmortem now include output from each engine that
  182. is installed.
  183. * :ref:`Debug page integration <template-debug-integration>` for custom
  184. template engines was added.
  185. * The :class:`~django.template.backends.django.DjangoTemplates` backend gained
  186. the ability to register libraries and builtins explicitly through the
  187. template :setting:`OPTIONS <TEMPLATES-OPTIONS>`.
  188. Requests and Responses
  189. ^^^^^^^^^^^^^^^^^^^^^^
  190. * Unless :attr:`HttpResponse.reason_phrase
  191. <django.http.HttpResponse.reason_phrase>` is explicitly set, it now is
  192. determined by the current value of :attr:`HttpResponse.status_code
  193. <django.http.HttpResponse.status_code>`. Modifying the value of
  194. ``status_code`` outside of the constructor will also modify the value of
  195. ``reason_phrase``.
  196. * The debug view now shows details of chained exceptions on Python 3.
  197. * The default 40x error views now accept a second positional parameter, the
  198. exception that triggered the view.
  199. Tests
  200. ^^^^^
  201. * ...
  202. URLs
  203. ^^^^
  204. * Regular expression lookaround assertions are now allowed in URL patterns.
  205. Validators
  206. ^^^^^^^^^^
  207. * Added :func:`django.core.validators.int_list_validator` to generate
  208. validators of strings containing integers separated with a custom character.
  209. * :class:`~django.core.validators.EmailValidator` now limits the length of
  210. domain name labels to 63 characters per :rfc:`1034`.
  211. Backwards incompatible changes in 1.9
  212. =====================================
  213. .. warning::
  214. In addition to the changes outlined in this section, be sure to review the
  215. :doc:`deprecation timeline </internals/deprecation>` for any features that
  216. have been removed. If you haven't updated your code within the
  217. deprecation timeline for a given feature, its removal may appear as a
  218. backwards incompatible change.
  219. Database backend API
  220. ~~~~~~~~~~~~~~~~~~~~
  221. * A couple of new tests rely on the ability of the backend to introspect column
  222. defaults (returning the result as ``Field.default``). You can set the
  223. ``can_introspect_default`` database feature to ``False`` if your backend
  224. doesn't implement this. You may want to review the implementation on the
  225. backends that Django includes for reference (:ticket:`24245`).
  226. * Registering a global adapter or converter at the level of the DB-API module
  227. to handle time zone information of :class:`~datetime.datetime` values passed
  228. as query parameters or returned as query results on databases that don't
  229. support time zones is discouraged. It can conflict with other libraries.
  230. The recommended way to add a time zone to :class:`~datetime.datetime` values
  231. fetched from the database is to register a converter for ``DateTimeField``
  232. in ``DatabaseOperations.get_db_converters()``.
  233. The ``needs_datetime_string_cast`` database feature was removed. Database
  234. backends that set it must register a converter instead, as explained above.
  235. * The ``DatabaseOperations.value_to_db_<type>()`` methods were renamed to
  236. ``adapt_<type>field_value()`` to mirror the ``convert_<type>field_value()``
  237. methods.
  238. Default settings that were tuples are now lists
  239. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  240. The default settings in ``django.conf.global_settings`` were a combination of
  241. lists and tuples. All settings that were formerly tuples are now lists.
  242. ``is_usable`` attribute on template loaders is removed
  243. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  244. Django template loaders previously required an ``is_usable`` attribute to be
  245. defined. If a loader was configured in the template settings and this attribute
  246. was ``False``, the loader would be silently ignored. In practice, this was only
  247. used by the egg loader to detect if setuptools was installed. The ``is_usable``
  248. attribute is now removed and the egg loader instead fails at runtime if
  249. setuptools is not installed.
  250. Related set direct assignment
  251. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  252. :ref:`Direct assignment <direct-assignment>`) used to perform a ``clear()``
  253. followed by a call to ``add()``. This caused needlessly large data changes
  254. and prevented using the :data:`~django.db.models.signals.m2m_changed` signal
  255. to track individual changes in many-to-many relations.
  256. Direct assignment now relies on the the new
  257. :meth:`django.db.models.fields.related.RelatedManager.set()` method on
  258. related managers which by default only processes changes between the
  259. existing related set and the one that's newly assigned. The previous behavior
  260. can be restored by replacing direct assignment by a call to ``set()`` with
  261. the keyword argument ``clear=True``.
  262. ``ModelForm``, and therefore ``ModelAdmin``, internally rely on direct
  263. assignment for many-to-many relations and as a consequence now use the new
  264. behavior.
  265. Filesystem-based template loaders catch more specific exceptions
  266. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  267. When using the :class:`filesystem.Loader <django.template.loaders.filesystem.Loader>`
  268. or :class:`app_directories.Loader <django.template.loaders.app_directories.Loader>`
  269. template loaders, earlier versions of Django raised a
  270. :exc:`~django.template.TemplateDoesNotExist` error if a template source existed
  271. but was unreadable. This could happen under many circumstances, such as if
  272. Django didn't have permissions to open the file, or if the template source was
  273. a directory. Now, Django only silences the exception if the template source
  274. does not exist. All other situations result in the original ``IOError`` being
  275. raised.
  276. HTTP redirects no longer forced to absolute URIs
  277. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  278. Relative redirects are no longer converted to absolute URIs. :rfc:`2616`
  279. required the ``Location`` header in redirect responses to be an absolute URI,
  280. but it has been superseded by :rfc:`7231` which allows relative URIs in
  281. ``Location``, recognizing the actual practice of user agents, almost all of
  282. which support them.
  283. Consequently, the expected URLs passed to ``assertRedirects`` should generally
  284. no longer include the scheme and domain part of the URLs. For example,
  285. ``self.assertRedirects(response, 'http://testserver/some-url/')`` should be
  286. replaced by ``self.assertRedirects(response, '/some-url/')`` (unless the
  287. redirection specifically contained an absolute URL, of course).
  288. Dropped support for PostgreSQL 9.0
  289. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  290. Upstream support for PostgreSQL 9.0 ended in September 2015. As a consequence,
  291. Django 1.9 sets 9.1 as the minimum PostgreSQL version it officially supports.
  292. Template ``LoaderOrigin`` and ``StringOrigin`` are removed
  293. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  294. In previous versions of Django, when a template engine was initialized with
  295. debug as ``True``, an instance of ``django.template.loader.LoaderOrigin`` or
  296. ``django.template.base.StringOrigin`` was set as the origin attribute on the
  297. template object. These classes have been combined into
  298. :class:`~django.template.base.Origin` and is now always set regardless of the
  299. engine debug setting.
  300. .. _default-logging-changes-19:
  301. Changes to the default logging configuration
  302. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  303. To make it easier to write custom logging configurations, Django's default
  304. logging configuration no longer defines 'django.request' and 'django.security'
  305. loggers. Instead, it defines a single 'django' logger with two handlers:
  306. * 'console': filtered at the ``INFO`` level and only active if ``DEBUG=True``.
  307. * 'mail_admins': filtered at the ``ERROR`` level and only active if
  308. ``DEBUG=False``.
  309. If you aren't overriding Django's default logging, you should see minimal
  310. changes in behavior, but you might see some new logging to the ``runserver``
  311. console, for example.
  312. If you are overriding Django's default logging, you should check to see how
  313. your configuration merges with the new defaults.
  314. Removal of time zone aware global adapters and converters for datetimes
  315. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  316. Django no longer registers global adapters and converters for managing time
  317. zone information on :class:`~datetime.datetime` values sent to the database as
  318. query parameters or read from the database in query results. This change
  319. affects projects that meet all the following conditions:
  320. * The :setting:`USE_TZ` setting is ``True``.
  321. * The database is SQLite, MySQL, Oracle, or a third-party database that
  322. doesn't support time zones. In doubt, you can check the value of
  323. ``connection.features.supports_timezones``.
  324. * The code queries the database outside of the ORM, typically with
  325. ``cursor.execute(sql, params)``.
  326. If you're passing aware :class:`~datetime.datetime` parameters to such
  327. queries, you should turn them into naive datetimes in UTC::
  328. from django.utils import timezone
  329. param = timezone.make_naive(param, timezone.utc)
  330. If you fail to do so, Django 1.9 and 2.0 will perform the conversion like
  331. earlier versions but emit a deprecation warning. Django 2.1 won't perform any
  332. conversion, which may result in data corruption.
  333. If you're reading :class:`~datetime.datetime` values from the results, they
  334. will be naive instead of aware. You can compensate as follows::
  335. from django.utils import timezone
  336. value = timezone.make_aware(value, timezone.utc)
  337. You don't need any of this if you're querying the database through the ORM,
  338. even if you're using :meth:`raw() <django.db.models.query.QuerySet.raw>`
  339. queries. The ORM takes care of managing time zone information.
  340. Template tag modules are imported when templates are configured
  341. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  342. The :class:`~django.template.backends.django.DjangoTemplates` backend now
  343. performs discovery on installed template tag modules when instantiated. This
  344. update enables libraries to be provided explicitly via the ``'libraries'``
  345. key of :setting:`OPTIONS <TEMPLATES-OPTIONS>` when defining a
  346. :class:`~django.template.backends.django.DjangoTemplates` backend. Import
  347. or syntax errors in template tag modules now fail early at instantiation time
  348. rather than when a template with a :ttag:`{% load %}<load>` tag is first
  349. compiled.
  350. ``django.template.base.add_to_builtins()`` is removed
  351. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  352. Although it was a private API, projects commonly used ``add_to_builtins()`` to
  353. make template tags and filters available without using the
  354. :ttag:`{% load %}<load>` tag. This API has been formalized. Projects should now
  355. define built-in libraries via the ``'builtins'`` key of :setting:`OPTIONS
  356. <TEMPLATES-OPTIONS>` when defining a
  357. :class:`~django.template.backends.django.DjangoTemplates` backend.
  358. Miscellaneous
  359. ~~~~~~~~~~~~~
  360. * CSS and images in ``contrib.admin`` to support Internet Explorer 6 & 7 have
  361. been removed as these browsers have reached end-of-life.
  362. * The text displayed for null columns in the admin changelist ``list_display``
  363. cells has changed from ``(None)`` (or its translated equivalent) to ``-``.
  364. * ``django.http.responses.REASON_PHRASES`` and
  365. ``django.core.handlers.wsgi.STATUS_CODE_TEXT`` have been removed. Use
  366. Python's stdlib instead: :data:`http.client.responses` for Python 3 and
  367. `httplib.responses`_ for Python 2.
  368. .. _`httplib.responses`: https://docs.python.org/2/library/httplib.html#httplib.responses
  369. * ``ValuesQuerySet`` and ``ValuesListQuerySet`` have been removed.
  370. * The ``admin/base.html`` template no longer sets
  371. ``window.__admin_media_prefix__``. Image references in JavaScript that used
  372. that value to construct absolute URLs have been moved to CSS for easier
  373. customization.
  374. * ``CommaSeparatedIntegerField`` validation has been refined to forbid values
  375. like ``','``, ``',1'``, and ``'1,,2'``.
  376. * Form initialization was moved from the :meth:`ProcessFormView.get()
  377. <django.views.generic.edit.ProcessFormView.get>` method to the new
  378. :meth:`FormMixin.get_context_data()
  379. <django.views.generic.edit.FormMixin.get_context_data>` method. This may be
  380. backwards incompatible if you have overridden the ``get_context_data()``
  381. method without calling ``super()``.
  382. * Support for PostGIS 1.5 has been dropped.
  383. * The ``django.contrib.sites.models.Site.domain`` field was changed to be
  384. :attr:`~django.db.models.Field.unique`.
  385. * In order to enforce test isolation, database queries are not allowed
  386. by default in :class:`~django.test.SimpleTestCase` tests anymore. You
  387. can disable this behavior by setting the
  388. :attr:`~django.test.SimpleTestCase.allow_database_queries` class attribute
  389. to ``True`` on your test class.
  390. .. _deprecated-features-1.9:
  391. Features deprecated in 1.9
  392. ==========================
  393. ``assignment_tag()``
  394. ~~~~~~~~~~~~~~~~~~~~
  395. Django 1.4 added the ``assignment_tag`` helper to ease the creation of
  396. template tags that store results in a template variable. The
  397. :meth:`~django.template.Library.simple_tag` helper has gained this same
  398. ability, making the ``assignment_tag`` obsolete. Tags that use
  399. ``assignment_tag`` should be updated to use ``simple_tag``.
  400. ``{% cycle %}`` syntax with comma-separated arguments
  401. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  402. The :ttag:`cycle` tag supports an inferior old syntax from previous Django
  403. versions:
  404. .. code-block:: html+django
  405. {% cycle row1,row2,row3 %}
  406. Its parsing caused bugs with the current syntax, so support for the old syntax
  407. will be removed in Django 2.0 following an accelerated deprecation.
  408. ``Field.rel`` changes
  409. ~~~~~~~~~~~~~~~~~~~~~
  410. ``Field.rel`` and its methods and attributes have changed to match the related
  411. fields API. The ``Field.rel`` attribute is renamed to ``remote_field`` and many
  412. of its methods and attributes are either changed or renamed.
  413. The aim of these changes is to provide a documented API for relation fields.
  414. ``GeoManager`` and ``GeoQuerySet`` custom methods
  415. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  416. All custom ``GeoQuerySet`` methods (``area()``, ``distance()``, ``gml()``, ...)
  417. have been replaced by equivalent geographic expressions in annotations (see in
  418. new features). Hence the need to set a custom ``GeoManager`` to GIS-enabled
  419. models is now obsolete. As soon as your code doesn't call any of the deprecated
  420. methods, you can simply remove the ``objects = GeoManager()`` lines from your
  421. models.
  422. Template loader APIs have changed
  423. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  424. Django template loaders have been updated to allow recursive template
  425. extending. This change necessitated a new template loader API. The old
  426. ``load_template()`` and ``load_template_sources()`` methods are now deprecated.
  427. Details about the new API can be found :ref:`in the template loader
  428. documentation <custom-template-loaders>`.
  429. Miscellaneous
  430. ~~~~~~~~~~~~~
  431. * The ``weak`` argument to ``django.dispatch.signals.Signal.disconnect()`` has
  432. been deprecated as it has no effect.
  433. * The ``check_aggregate_support()`` method of
  434. ``django.db.backends.base.BaseDatabaseOperations`` has been deprecated and
  435. will be removed in Django 2.1. The more general ``check_expression_support()``
  436. should be used instead.
  437. * ``django.forms.extras`` is deprecated. You can find
  438. :class:`~django.forms.SelectDateWidget` in ``django.forms.widgets``
  439. (or simply ``django.forms``) instead.
  440. * Private API ``django.db.models.fields.add_lazy_relation()`` is deprecated.
  441. * The ``django.contrib.auth.tests.utils.skipIfCustomUser()`` decorator is
  442. deprecated. With the test discovery changes in Django 1.6, the tests for
  443. ``django.contrib`` apps are no longer run as part of the user's project.
  444. Therefore, the ``@skipIfCustomUser`` decorator is no longer needed to
  445. decorate tests in ``django.contrib.auth``.
  446. * If you customized some :ref:`error handlers <error-views>`, the view
  447. signatures with only one request parameter are deprecated. The views should
  448. now also accept a second ``exception`` positional parameter.
  449. .. removed-features-1.9:
  450. Features removed in 1.9
  451. =======================
  452. These features have reached the end of their deprecation cycle and so have been
  453. removed in Django 1.9 (please see the :ref:`deprecation timeline
  454. <deprecation-removed-in-1.9>` for more details):
  455. * ``django.utils.dictconfig`` is removed.
  456. * ``django.utils.importlib`` is removed.
  457. * ``django.utils.tzinfo`` is removed.
  458. * ``django.utils.unittest`` is removed.
  459. * The ``syncdb`` command is removed.
  460. * ``django.db.models.signals.pre_syncdb`` and
  461. ``django.db.models.signals.post_syncdb`` is removed.
  462. * Support for ``allow_syncdb`` on database routers is removed.
  463. * The legacy method of syncing apps without migrations is removed,
  464. and migrations are compulsory for all apps. This includes automatic
  465. loading of ``initial_data`` fixtures and support for initial SQL data.
  466. * All models need to be defined inside an installed application or declare an
  467. explicit :attr:`~django.db.models.Options.app_label`. Furthermore, it isn't
  468. possible to import them before their application is loaded. In particular, it
  469. isn't possible to import models inside the root package of an application.
  470. * The model and form ``IPAddressField`` is removed. A stub field remains for
  471. compatibility with historical migrations.
  472. * ``AppCommand.handle_app()`` is no longer be supported.
  473. * ``RequestSite`` and ``get_current_site()`` are no longer importable from
  474. ``django.contrib.sites.models``.
  475. * FastCGI support via the ``runfcgi`` management command is removed.
  476. * ``django.utils.datastructures.SortedDict`` is removed.
  477. * ``ModelAdmin.declared_fieldsets`` is removed.
  478. * The ``util`` modules that provided backwards compatibility are removed:
  479. * ``django.contrib.admin.util``
  480. * ``django.contrib.gis.db.backends.util``
  481. * ``django.db.backends.util``
  482. * ``django.forms.util``
  483. * ``ModelAdmin.get_formsets`` is removed.
  484. * The backward compatible shims introduced to rename the
  485. ``BaseMemcachedCache._get_memcache_timeout()`` method to
  486. ``get_backend_timeout()`` is removed.
  487. * The ``--natural`` and ``-n`` options for :djadmin:`dumpdata` are removed.
  488. * The ``use_natural_keys`` argument for ``serializers.serialize()`` is removed.
  489. * Private API ``django.forms.forms.get_declared_fields()`` is removed.
  490. * The ability to use a ``SplitDateTimeWidget`` with ``DateTimeField`` is
  491. removed.
  492. * The ``WSGIRequest.REQUEST`` property is removed.
  493. * The class ``django.utils.datastructures.MergeDict`` is removed.
  494. * The ``zh-cn`` and ``zh-tw`` language codes are removed.
  495. * The internal ``django.utils.functional.memoize()`` is removed.
  496. * ``django.core.cache.get_cache`` is removed.
  497. * ``django.db.models.loading`` is removed.
  498. * Passing callable arguments to querysets is no longer possible.
  499. * ``BaseCommand.requires_model_validation`` is removed in favor of
  500. ``requires_system_checks``. Admin validators is replaced by admin checks.
  501. * The ``ModelAdmin.validator_class`` and ``default_validator_class`` attributes
  502. are removed.
  503. * ``ModelAdmin.validate()`` is removed.
  504. * ``django.db.backends.DatabaseValidation.validate_field`` is removed in
  505. favor of the ``check_field`` method.
  506. * The ``validate`` management command is removed.
  507. * ``django.utils.module_loading.import_by_path`` is removed in favor of
  508. ``django.utils.module_loading.import_string``.
  509. * ``ssi`` and ``url`` template tags are removed from the ``future`` template
  510. tag library.
  511. * ``django.utils.text.javascript_quote()`` is removed.
  512. * Database test settings as independent entries in the database settings,
  513. prefixed by ``TEST_``, are no longer supported.
  514. * The `cache_choices` option to :class:`~django.forms.ModelChoiceField` and
  515. :class:`~django.forms.ModelMultipleChoiceField` is removed.
  516. * The default value of the
  517. :attr:`RedirectView.permanent <django.views.generic.base.RedirectView.permanent>`
  518. attribute has changed from ``True`` to ``False``.
  519. * ``django.contrib.sitemaps.FlatPageSitemap`` is removed in favor of
  520. ``django.contrib.flatpages.sitemaps.FlatPageSitemap``.
  521. * Private API ``django.test.utils.TestTemplateLoader`` is removed.
  522. * The ``django.contrib.contenttypes.generic`` module is removed.