1.10.txt 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. =============================================
  2. Django 1.10 release notes - UNDER DEVELOPMENT
  3. =============================================
  4. Welcome to Django 1.10!
  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.9 or older versions. We've :ref:`dropped some features<removed-features-1.10>`
  8. that have reached the end of their deprecation cycle, and we've `begun the
  9. deprecation process for some features`_.
  10. .. _`new features`: `What's new in Django 1.10`_
  11. .. _`backwards incompatible changes`: `Backwards incompatible changes in 1.10`_
  12. .. _`dropped some features`: `Features removed in 1.10`_
  13. .. _`begun the deprecation process for some features`: `Features deprecated in 1.10`_
  14. Python compatibility
  15. ====================
  16. Like Django 1.9, Django 1.10 requires Python 2.7, 3.4, or 3.5. We **highly
  17. recommend** and only officially support the latest release of each series.
  18. What's new in Django 1.10
  19. =========================
  20. Full text search for PostgreSQL
  21. -------------------------------
  22. ``django.contrib.postgres`` now includes a :doc:`collection of database
  23. functions </ref/contrib/postgres/search>` to allow the use of the full text
  24. search engine. You can search across multiple fields in your relational
  25. database, combine the searches with other lookups, use different language
  26. configurations and weightings, and rank the results by relevance.
  27. It also now includes trigram support, using the :lookup:`trigram_similar`
  28. lookup, and the :class:`~django.contrib.postgres.search.TrigramSimilarity` and
  29. :class:`~django.contrib.postgres.search.TrigramDistance` expressions.
  30. Minor features
  31. --------------
  32. :mod:`django.contrib.admin`
  33. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. * For sites running on a subpath, the default :attr:`URL for the "View site"
  35. link <django.contrib.admin.AdminSite.site_url>` at the top of each admin page
  36. will now point to ``request.META['SCRIPT_NAME']`` if set, instead of ``/``.
  37. * The success message that appears after adding or editing an object now
  38. contains a link to the object's change form.
  39. * All inline JavaScript is removed so you can enable the
  40. ``Content-Security-Policy`` HTTP header if you wish.
  41. * The new :attr:`InlineModelAdmin.classes
  42. <django.contrib.admin.InlineModelAdmin.classes>` attribute allows specifying
  43. classes on inline fieldsets. Inlines with a ``collapse`` class will be
  44. initially collapsed and their header will have a small "show" link.
  45. * If a user doesn't have the add permission, the ``object-tools`` block on a
  46. model's changelist will now be rendered (without the add button, of course).
  47. This makes it easier to add custom tools in this case.
  48. * The :class:`~django.contrib.admin.models.LogEntry` model now stores change
  49. messages in a JSON structure so that the message can be dynamically translated
  50. using the current active language. A new ``LogEntry.get_change_message()``
  51. method is now the preferred way of retrieving the change message.
  52. * Selected objects for fields in ``ModelAdmin.raw_id_fields`` now have a link
  53. to object's change form.
  54. * Added "No date" and "Has date" choices for ``DateFieldListFilter`` if the
  55. field is nullable.
  56. :mod:`django.contrib.admindocs`
  57. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58. * ...
  59. :mod:`django.contrib.auth`
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. * Added support for the :ref:`Argon2 password hash <argon2_usage>`. It's
  62. recommended over PBKDF2, however, it's not the default as it requires a
  63. third-party library.
  64. * The default iteration count for the PBKDF2 password hasher has been increased
  65. by 25%. This backwards compatible change will not affect users who have
  66. subclassed ``django.contrib.auth.hashers.PBKDF2PasswordHasher`` to change the
  67. default value.
  68. * The :func:`~django.contrib.auth.views.logout` view sends "no-cache" headers
  69. to prevent an issue where Safari caches redirects and prevents a user from
  70. being able to log out.
  71. * Added the optional ``backend`` argument to :func:`~django.contrib.auth.login`
  72. to allow using it without credentials.
  73. * The new :setting:`LOGOUT_REDIRECT_URL` setting controls the redirect of the
  74. :func:`~django.contrib.auth.views.logout` view, if the view doesn't get a
  75. ``next_page`` argument.
  76. * The new ``redirect_authenticated_user`` parameter for the
  77. :func:`~django.contrib.auth.views.login` view allows redirecting
  78. authenticated users visiting the login page.
  79. :mod:`django.contrib.contenttypes`
  80. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  81. * ...
  82. :mod:`django.contrib.gis`
  83. ~~~~~~~~~~~~~~~~~~~~~~~~~
  84. * :ref:`Distance lookups <distance-lookups>` now accept expressions as the
  85. distance value parameter.
  86. * The new :attr:`GEOSGeometry.unary_union
  87. <django.contrib.gis.geos.GEOSGeometry.unary_union>` property computes the
  88. union of all the elements of this geometry.
  89. * Added the :meth:`GEOSGeometry.covers()
  90. <django.contrib.gis.geos.GEOSGeometry.covers>` binary predicate.
  91. * Added the :meth:`GDALBand.statistics()
  92. <django.contrib.gis.gdal.GDALBand.statistics>` method and
  93. :attr:`~django.contrib.gis.gdal.GDALBand.mean`
  94. and :attr:`~django.contrib.gis.gdal.GDALBand.std` attributes.
  95. * Added support for the :class:`~django.contrib.gis.db.models.MakeLine`
  96. aggregate and :class:`~django.contrib.gis.db.models.functions.GeoHash`
  97. function on SpatiaLite.
  98. * Added support for the
  99. :class:`~django.contrib.gis.db.models.functions.Difference`,
  100. :class:`~django.contrib.gis.db.models.functions.Intersection`, and
  101. :class:`~django.contrib.gis.db.models.functions.SymDifference`
  102. functions on MySQL.
  103. * Added support for instantiating empty GEOS geometries.
  104. * The new :attr:`~django.contrib.gis.geos.WKTWriter.trim` and
  105. :attr:`~django.contrib.gis.geos.WKTWriter.precision` properties
  106. of :class:`~django.contrib.gis.geos.WKTWriter` allow controlling
  107. output of the fractional part of the coordinates in WKT.
  108. * Added the :attr:`LineString.closed
  109. <django.contrib.gis.geos.LineString.closed>` and
  110. :attr:`MultiLineString.closed
  111. <django.contrib.gis.geos.MultiLineString.closed>` properties.
  112. * The :doc:`GeoJSON serializer </ref/contrib/gis/serializers>` now outputs the
  113. primary key of objects in the ``properties`` dictionary if specific fields
  114. aren't specified.
  115. * The ability to replicate input data on the :meth:`GDALBand.data()
  116. <django.contrib.gis.gdal.GDALBand.data>` method was added. Band data can
  117. now be updated with repeated values efficiently.
  118. * Added database functions
  119. :class:`~django.contrib.gis.db.models.functions.IsValid` and
  120. :class:`~django.contrib.gis.db.models.functions.MakeValid`, as well as the
  121. :lookup:`isvalid` lookup, all for PostGIS. This allows filtering and
  122. repairing invalid geometries on the database side.
  123. * Added raster support for all :doc:`spatial lookups
  124. </ref/contrib/gis/geoquerysets>`.
  125. :mod:`django.contrib.messages`
  126. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  127. * ...
  128. :mod:`django.contrib.postgres`
  129. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. * For convenience, :class:`~django.contrib.postgres.fields.HStoreField` now
  131. casts its keys and values to strings.
  132. :mod:`django.contrib.redirects`
  133. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134. * ...
  135. :mod:`django.contrib.sessions`
  136. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  137. * The :djadmin:`clearsessions` management command now removes file-based
  138. sessions.
  139. :mod:`django.contrib.sitemaps`
  140. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  141. * ...
  142. :mod:`django.contrib.sites`
  143. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  144. * The :class:`~django.contrib.sites.models.Site` model now supports
  145. :ref:`natural keys <topics-serialization-natural-keys>`.
  146. :mod:`django.contrib.staticfiles`
  147. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  148. * The :ttag:`static` template tag now uses ``django.contrib.staticfiles``
  149. if it's in ``INSTALLED_APPS``. This is especially useful for third-party apps
  150. which can now always use ``{% load static %}`` (instead of
  151. ``{% load staticfiles %}`` or ``{% load static from staticfiles %}``) and
  152. not worry about whether or not the ``staticfiles`` app is installed.
  153. :mod:`django.contrib.syndication`
  154. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  155. * ...
  156. Cache
  157. ~~~~~
  158. * The file-based cache backend now uses the highest pickling protocol.
  159. CSRF
  160. ~~~~
  161. * The default :setting:`CSRF_FAILURE_VIEW`, ``views.csrf.csrf_failure()`` now
  162. accepts an optional ``template_name`` parameter, defaulting to
  163. ``'403_csrf.html'``, to control the template used to render the page.
  164. Database backends
  165. ~~~~~~~~~~~~~~~~~
  166. * Temporal data subtraction was unified on all backends.
  167. * If the database supports it, backends can set
  168. ``DatabaseFeatures.can_return_ids_from_bulk_insert=True`` and implement
  169. ``DatabaseOperations.fetch_returned_insert_ids()`` to set primary keys
  170. on objects created using ``QuerySet.bulk_create()``.
  171. * Added keyword arguments to the ``as_sql()`` methods of various expressions
  172. (``Func``, ``When``, ``Case``, and ``OrderBy``) to allow database backends to
  173. customize them without mutating ``self``, which isn't safe when using
  174. different database backends. See the ``arg_joiner`` and ``**extra_context``
  175. parameters of :meth:`Func.as_sql() <django.db.models.Func.as_sql>` for an
  176. example.
  177. Email
  178. ~~~~~
  179. * ...
  180. File Storage
  181. ~~~~~~~~~~~~
  182. * Storage backends now present a timezone-aware API with new methods
  183. :meth:`~django.core.files.storage.Storage.get_accessed_time`,
  184. :meth:`~django.core.files.storage.Storage.get_created_time`, and
  185. :meth:`~django.core.files.storage.Storage.get_modified_time`. They return a
  186. timezone-aware ``datetime`` if :setting:`USE_TZ` is ``True`` and a naive
  187. ``datetime`` in the local timezone otherwise.
  188. * The new :meth:`Storage.generate_filename()
  189. <django.core.files.storage.Storage.generate_filename>` method makes it easier
  190. to implement custom storages that don't use the ``os.path`` calls previously
  191. in :class:`~django.db.models.FileField`.
  192. File Uploads
  193. ~~~~~~~~~~~~
  194. * ...
  195. Forms
  196. ~~~~~
  197. * Form and widget ``Media`` is now served using
  198. :mod:`django.contrib.staticfiles` if installed.
  199. * The ``<input>`` tag rendered by :class:`~django.forms.CharField` now includes
  200. a ``minlength`` attribute if the field has a ``min_length``.
  201. * Required form fields now have the ``required`` HTML attribute. Set the new
  202. :attr:`Form.use_required_attribute <django.forms.Form.use_required_attribute>`
  203. attribute to ``False`` to disable it. The ``required`` attribute isn't
  204. included on forms of formsets because the browser validation may not be
  205. correct when adding and deleting formsets.
  206. Generic Views
  207. ~~~~~~~~~~~~~
  208. * The :class:`~django.views.generic.base.View` class can now be imported from
  209. ``django.views``.
  210. Internationalization
  211. ~~~~~~~~~~~~~~~~~~~~
  212. * The :func:`~django.conf.urls.i18n.i18n_patterns` helper function can now be
  213. used in a root URLConf specified using :attr:`request.urlconf
  214. <django.http.HttpRequest.urlconf>`.
  215. * By setting the new ``prefix_default_language`` parameter for
  216. :func:`~django.conf.urls.i18n.i18n_patterns` to ``False``, you can allow
  217. accessing the default language without a URL prefix.
  218. * :func:`~django.views.i18n.set_language` now returns a 204 status code (No
  219. Content) for AJAX requests when there is no ``next`` parameter in ``POST`` or
  220. ``GET``.
  221. * The :class:`~django.views.i18n.JavaScriptCatalog` and
  222. :class:`~django.views.i18n.JSONCatalog` class-based views supersede the
  223. deprecated ``javascript_catalog()`` and ``json_catalog()`` function-based
  224. views. The new views are almost equivalent to the old ones except that by
  225. default the new views collect all JavaScript strings in the ``djangojs``
  226. translation domain from all installed apps rather than only the JavaScript
  227. strings from :setting:`LOCALE_PATHS`.
  228. Management Commands
  229. ~~~~~~~~~~~~~~~~~~~
  230. * :func:`~django.core.management.call_command` now returns the value returned
  231. from the ``command.handle()`` method.
  232. * The new :option:`check --fail-level` option allows specifying the message
  233. level that will cause the command to exit with a non-zero status.
  234. * The new :option:`makemigrations --check` option makes the command exit
  235. with a non-zero status when model changes without migrations are detected.
  236. * :djadmin:`makemigrations` now displays the path to the migration files that
  237. it generates.
  238. * The :option:`shell --interface` option now accepts ``python`` to force use of
  239. the "plain" Python interpreter.
  240. * The new :option:`shell --command` option lets you run a command as Django and
  241. exit, instead of opening the interactive shell.
  242. * Added a warning to :djadmin:`dumpdata` if a proxy model is specified (which
  243. results in no output) without its concrete parent.
  244. * The new :attr:`BaseCommand.requires_migrations_checks
  245. <django.core.management.BaseCommand.requires_migrations_checks>` attribute
  246. may be set to ``True`` if you want your command to print a warning, like
  247. :djadmin:`runserver` does, if the set of migrations on disk don't match the
  248. migrations in the database.
  249. * To assist with testing, :func:`~django.core.management.call_command` now
  250. accepts a command object as the first argument.
  251. * The :djadmin:`shell` command supports tab completion on systems using
  252. ``libedit``, e.g. Mac OSX.
  253. * The :djadmin:`inspectdb` command lets you choose what tables should be
  254. inspected by specifying their names as arguments.
  255. Migrations
  256. ~~~~~~~~~~
  257. * Added support for serialization of ``enum.Enum`` objects.
  258. * Added the ``elidable`` argument to the
  259. :class:`~django.db.migrations.operations.RunSQL` and
  260. :class:`~django.db.migrations.operations.RunPython` operations to allow them
  261. to be removed when squashing migrations.
  262. * Added support for :ref:`non-atomic migrations <non-atomic-migrations>` by
  263. setting the ``atomic`` attribute on a ``Migration``.
  264. * The ``migrate`` and ``makemigrations`` commands now check for a consistent
  265. migration history. If they find some unapplied dependencies of an applied
  266. migration, ``InconsistentMigrationHistory`` is raised.
  267. * The :func:`~django.db.models.signals.pre_migrate` and
  268. :func:`~django.db.models.signals.post_migrate` signals now dispatch their
  269. migration ``plan`` and ``apps``.
  270. Models
  271. ~~~~~~
  272. * Reverse foreign keys from proxy models are now propagated to their
  273. concrete class. The reverse relation attached by a
  274. :class:`~django.db.models.ForeignKey` pointing to a proxy model is now
  275. accessible as a descriptor on the proxied model class and may be referenced in
  276. queryset filtering.
  277. * The new :meth:`Field.rel_db_type() <django.db.models.Field.rel_db_type>`
  278. method returns the database column data type for fields such as ``ForeignKey``
  279. and ``OneToOneField`` that point to another field.
  280. * The :attr:`~django.db.models.Func.arity` class attribute is added to
  281. :class:`~django.db.models.Func`. This attribute can be used to set the number
  282. of arguments the function accepts.
  283. * Added :class:`~django.db.models.BigAutoField` which acts much like an
  284. :class:`~django.db.models.AutoField` except that it is guaranteed
  285. to fit numbers from ``1`` to ``9223372036854775807``.
  286. * :meth:`QuerySet.in_bulk() <django.db.models.query.QuerySet.in_bulk>`
  287. may be called without any arguments to return all objects in the queryset.
  288. * :attr:`~django.db.models.ForeignKey.related_query_name` now supports
  289. app label and class interpolation using the ``'%(app_label)s'`` and
  290. ``'%(class)s'`` strings.
  291. * Allowed overriding model fields inherited from abstract base classes.
  292. * The :func:`~django.db.models.prefetch_related_objects` function is now a
  293. public API.
  294. * :meth:`QuerySet.bulk_create() <django.db.models.query.QuerySet.bulk_create>`
  295. sets the primary key on objects when using PostgreSQL.
  296. * Added the :class:`~django.db.models.functions.Cast` database function.
  297. * A proxy model may now inherit multiple proxy models that share a common
  298. non-abstract parent class.
  299. * ``Model.__init__()`` now sets values of virtual fields from its keyword
  300. arguments.
  301. Requests and Responses
  302. ~~~~~~~~~~~~~~~~~~~~~~
  303. * Added ``request.user`` to the debug view.
  304. * Added :class:`~django.http.HttpResponse` methods
  305. :meth:`~django.http.HttpResponse.readable()` and
  306. :meth:`~django.http.HttpResponse.seekable()` to make an instance a
  307. stream-like object and allow wrapping it with :py:class:`io.TextIOWrapper`.
  308. * Added the :attr:`HttpResponse.content_type
  309. <django.http.HttpRequest.content_type>` and
  310. :attr:`~django.http.HttpRequest.content_params` attributes which are
  311. parsed from the ``CONTENT_TYPE`` header.
  312. * The parser for ``request.COOKIES`` is simplified to better match the behavior
  313. of browsers. ``request.COOKIES`` may now contain cookies that are invalid
  314. according to :rfc:`6265` but are possible to set via ``document.cookie``.
  315. Serialization
  316. ~~~~~~~~~~~~~
  317. * The ``django.core.serializers.json.DjangoJSONEncoder`` now knows how to
  318. serialize lazy strings, typically used for translatable content.
  319. Signals
  320. ~~~~~~~
  321. * ...
  322. Templates
  323. ~~~~~~~~~
  324. * Added the ``autoescape`` option to the
  325. :class:`~django.template.backends.django.DjangoTemplates` backend and the
  326. :class:`~django.template.Engine` class.
  327. * Added the ``is`` and ``is not`` comparison operators to the :ttag:`if` tag.
  328. * Allowed :tfilter:`dictsort` to order a list of lists by an element at a
  329. specified index.
  330. * The :func:`~django.template.context_processors.debug` context processor
  331. contains queries for all database aliases instead of only the default alias.
  332. * Added relative path support for string arguments of the :ttag:`extends` and
  333. :ttag:`include` template tags.
  334. Tests
  335. ~~~~~
  336. * To better catch bugs, :class:`~django.test.TestCase` now checks deferrable
  337. database constraints at the end of each test.
  338. * Tests and test cases can be :ref:`marked with tags <topics-tagging-tests>`
  339. and run selectively with the new :option:`test --tag` and :option:`test
  340. --exclude-tag` options.
  341. * Added the :setting:`DATABASES['TEST']['MIGRATE'] <TEST_MIGRATE>` option to
  342. allow disabling of migrations during test database creation.
  343. * You can now login and use sessions with the test client even if
  344. :mod:`django.contrib.sessions` is not in :setting:`INSTALLED_APPS`.
  345. URLs
  346. ~~~~
  347. * An addition in :func:`django.setup()` allows URL resolving that happens
  348. outside of the request/response cycle (e.g. in management commands and
  349. standalone scripts) to take :setting:`FORCE_SCRIPT_NAME` into account when it
  350. is set.
  351. Validators
  352. ~~~~~~~~~~
  353. * :class:`~django.core.validators.URLValidator` now limits the length of
  354. domain name labels to 63 characters and the total length of domain
  355. names to 253 characters per :rfc:`1034`.
  356. * :func:`~django.core.validators.int_list_validator` now accepts an optional
  357. ``allow_negative`` boolean parameter, defaulting to ``False``, to allow
  358. negative integers.
  359. Backwards incompatible changes in 1.10
  360. ======================================
  361. .. warning::
  362. In addition to the changes outlined in this section, be sure to review the
  363. :ref:`removed-features-1.10` for the features that have reached the end of
  364. their deprecation cycle and therefore been removed. If you haven't updated
  365. your code within the deprecation timeline for a given feature, its removal
  366. may appear as a backwards incompatible change.
  367. Database backend API
  368. --------------------
  369. * GIS's ``AreaField`` uses an unspecified underlying numeric type that could in
  370. practice be any numeric Python type. ``decimal.Decimal`` values retrieved
  371. from the database are now converted to ``float`` to make it easier to combine
  372. them with values used by the GIS libraries.
  373. * In order to enable temporal subtraction you must set the
  374. ``supports_temporal_subtraction`` database feature flag to ``True`` and
  375. implement the ``DatabaseOperations.subtract_temporals()`` method. This
  376. method should return the SQL and parameters required to compute the
  377. difference in microseconds between the ``lhs`` and ``rhs`` arguments in the
  378. datatype used to store :class:`~django.db.models.DurationField`.
  379. ``select_related()`` prohibits non-relational fields for nested relations
  380. -------------------------------------------------------------------------
  381. Django 1.8 added validation for non-relational fields in ``select_related()``::
  382. >>> Book.objects.select_related('title')
  383. Traceback (most recent call last):
  384. ...
  385. FieldError: Non-relational field given in select_related: 'title'
  386. But it didn't prohibit nested non-relation fields as it does now::
  387. >>> Book.objects.select_related('author__name')
  388. Traceback (most recent call last):
  389. ...
  390. FieldError: Non-relational field given in select_related: 'name'
  391. ``_meta.get_fields()`` returns consistent reverse fields for proxy models
  392. -------------------------------------------------------------------------
  393. Before Django 1.10, the :meth:`~django.db.models.options.Options.get_fields`
  394. method returned different reverse fields when called on a proxy model compared
  395. to its proxied concrete class. This inconsistency was fixed by returning the
  396. full set of fields pointing to a concrete class or one of its proxies in both
  397. cases.
  398. :attr:`AbstractUser.username <django.contrib.auth.models.User.username>` ``max_length`` increased to 150
  399. --------------------------------------------------------------------------------------------------------
  400. A migration for :attr:`django.contrib.auth.models.User.username` is included.
  401. If you have a custom user model inheriting from ``AbstractUser``, you'll need
  402. to generate and apply a database migration for your user model.
  403. We considered an increase to 254 characters to more easily allow the use of
  404. email addresses (which are limited to 254 characters) as usernames but rejected
  405. it due to a MySQL limitation. When using the ``utf8mb4`` encoding (recommended
  406. for proper Unicode support), MySQL can only create unique indexes with 191
  407. characters by default. Therefore, if you need a longer length, please use a
  408. custom user model.
  409. If you want to preserve the 30 character limit for usernames, use a custom form
  410. when creating a user or changing usernames::
  411. from django.contrib.auth.forms import UserCreationForm
  412. class MyUserCreationForm(UserCreationForm):
  413. username = forms.CharField(
  414. max_length=30,
  415. help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
  416. )
  417. If you wish to keep this restriction in the admin, set ``UserAdmin.add_form``
  418. to use this form::
  419. from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
  420. from django.contrib.auth.models import User
  421. class UserAdmin(BaseUserAdmin):
  422. add_form = MyUserCreationForm
  423. admin.site.unregister(User)
  424. admin.site.register(User, UserAdmin)
  425. Dropped support for PostgreSQL 9.1
  426. ----------------------------------
  427. Upstream support for PostgreSQL 9.1 ends in September 2016. As a consequence,
  428. Django 1.10 sets PostgreSQL 9.2 as the minimum version it officially supports.
  429. ``runserver`` output goes through logging
  430. -----------------------------------------
  431. Request and response handling of the ``runserver`` command is sent to the
  432. :ref:`django-server-logger` logger instead of to ``sys.stderr``. If you
  433. disable Django's logging configuration or override it with your own, you'll
  434. need to add the appropriate logging configuration if you want to see that
  435. output::
  436. 'formatters': {
  437. 'django.server': {
  438. '()': 'django.utils.log.ServerFormatter',
  439. 'format': '[%(server_time)s] %(message)s',
  440. }
  441. },
  442. 'handlers': {
  443. 'django.server': {
  444. 'level': 'INFO',
  445. 'class': 'logging.StreamHandler',
  446. 'formatter': 'django.server',
  447. },
  448. },
  449. 'loggers': {
  450. 'django.server': {
  451. 'handlers': ['django.server'],
  452. 'level': 'INFO',
  453. 'propagate': False,
  454. }
  455. }
  456. ``auth.CustomUser`` and ``auth.ExtensionUser`` test models were removed
  457. -----------------------------------------------------------------------
  458. Since the introduction of migrations for the contrib apps in Django 1.8, the
  459. tables of these custom user test models were not created anymore making them
  460. unusable in a testing context.
  461. Apps registry is no longer auto-populated when unpickling models outside of Django
  462. ----------------------------------------------------------------------------------
  463. The apps registry is no longer auto-populated when unpickling models. This was
  464. added in Django 1.7.2 as an attempt to allow unpickling models outside of
  465. Django, such as in an RQ worker, without calling ``django.setup()``, but it
  466. creates the possibility of a deadlock. To adapt your code in the case of RQ,
  467. you can `provide your own worker script <http://python-rq.org/docs/workers/>`_
  468. that calls ``django.setup()``.
  469. Removed null assignment check for non-null foreign key fields
  470. -------------------------------------------------------------
  471. In older versions, assigning ``None`` to a non-nullable ``ForeignKey`` or
  472. ``OneToOneField`` raised ``ValueError('Cannot assign None: "model.field" does
  473. not allow null values.')``. For consistency with other model fields which don't
  474. have a similar check, this check is removed.
  475. Removed weak password hashers from the default ``PASSWORD_HASHERS`` setting
  476. ---------------------------------------------------------------------------
  477. Django 0.90 stored passwords as unsalted MD5. Django 0.91 added support for
  478. salted SHA1 with automatic upgrade of passwords when a user logs in. Django 1.4
  479. added PBKDF2 as the default password hasher.
  480. If you have an old Django project with MD5 or SHA1 (even salted) encoded
  481. passwords, be aware that these can be cracked fairly easily with today's
  482. hardware. To make Django users acknowledge continued use of weak hashers, the
  483. following hashers are removed from the default :setting:`PASSWORD_HASHERS`
  484. setting::
  485. 'django.contrib.auth.hashers.SHA1PasswordHasher'
  486. 'django.contrib.auth.hashers.MD5PasswordHasher'
  487. 'django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher'
  488. 'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher'
  489. 'django.contrib.auth.hashers.CryptPasswordHasher'
  490. Consider using a :ref:`wrapped password hasher <wrapping-password-hashers>` to
  491. strengthen the hashes in your database. If that's not feasible, add the
  492. :setting:`PASSWORD_HASHERS` setting to your project and add back any hashers
  493. that you need.
  494. You can check if your database has any of the removed hashers like this::
  495. from django.contrib.auth import get_user_model
  496. User = get_user_model()
  497. # Unsalted MD5/SHA1:
  498. User.objects.filter(password__startswith='md5$$')
  499. User.objects.filter(password__startswith='sha1$$')
  500. # Salted MD5/SHA1:
  501. User.objects.filter(password__startswith='md5$').exclude(password__startswith='md5$$')
  502. User.objects.filter(password__startswith='sha1$').exclude(password__startswith='sha1$$')
  503. # Crypt hasher:
  504. User.objects.filter(password__startswith='crypt$$')
  505. from django.db.models import CharField
  506. from django.db.models.functions import Length
  507. CharField.register_lookup(Length)
  508. # Unsalted MD5 passwords might not have an 'md5$$' prefix:
  509. User.objects.filter(password__length=32)
  510. ``Field.get_prep_lookup()`` and ``Field.get_db_prep_lookup()`` methods are removed
  511. ----------------------------------------------------------------------------------
  512. If you have a custom field that implements either of these methods, register a
  513. custom lookup for it. For example::
  514. from django.db.models import Field
  515. from django.db.models.lookups import Exact
  516. class MyField(Field):
  517. ...
  518. class MyFieldExact(Exact):
  519. def get_prep_lookup(self):
  520. # do_custom_stuff_for_myfield
  521. ....
  522. MyField.register_lookup(MyFieldExact)
  523. :mod:`django.contrib.gis`
  524. -------------------------
  525. * Support for SpatiaLite < 3.0 and GEOS < 3.3 is dropped.
  526. * The ``add_postgis_srs()`` backwards compatibility alias for
  527. ``django.contrib.gis.utils.add_srs_entry()`` is removed.
  528. * On Oracle/GIS, the :class:`~django.contrib.gis.db.models.functions.Area`
  529. aggregate function now returns a ``float`` instead of ``decimal.Decimal``.
  530. (It's still wrapped in a measure of square meters.)
  531. * The default :class:`~django.contrib.gis.geos.GEOSGeometry` representation (WKT
  532. output) is trimmed by default. That is, instead of
  533. ``POINT (23.0000000000000000 5.5000000000000000)``, you'll get
  534. ``POINT (23 5.5)``.
  535. Maximum size of a request body and the number of GET/POST parameters is limited
  536. -------------------------------------------------------------------------------
  537. Two new settings help mitigate denial-of-service attacks via large requests:
  538. * :setting:`DATA_UPLOAD_MAX_MEMORY_SIZE` limits the size that a request body
  539. may be. File uploads don't count towards this limit.
  540. * :setting:`DATA_UPLOAD_MAX_NUMBER_FIELDS` limits the number of GET/POST
  541. parameters that are parsed.
  542. Applications that receive unusually large form posts may need to tune these
  543. settings.
  544. Miscellaneous
  545. -------------
  546. * The ``repr()`` of a ``QuerySet`` is wrapped in ``<QuerySet >`` to
  547. disambiguate it from a plain list when debugging.
  548. * ``utils.version.get_version()`` returns :pep:`440` compliant release
  549. candidate versions (e.g. '1.10rc1' instead of '1.10c1').
  550. * The ``LOGOUT_URL`` setting is removed as Django hasn't made use of it
  551. since pre-1.0. If you use it in your project, you can add it to your
  552. project's settings. The default value was ``'/accounts/logout/'``.
  553. * Objects with a ``close()`` method such as files and generators passed to
  554. :class:`~django.http.HttpResponse` are now closed immediately instead of when
  555. the WSGI server calls ``close()`` on the response.
  556. * A redundant ``transaction.atomic()`` call in ``QuerySet.update_or_create()``
  557. is removed. This may affect query counts tested by
  558. ``TransactionTestCase.assertNumQueries()``.
  559. * Support for ``skip_validation`` in ``BaseCommand.execute(**options)`` is
  560. removed. Use ``skip_checks`` (added in Django 1.7) instead.
  561. * :djadmin:`loaddata` now raises a ``CommandError`` instead of showing a
  562. warning when the specified fixture file is not found.
  563. * Instead of directly accessing the ``LogEntry.change_message`` attribute, it's
  564. now better to call the ``LogEntry.get_change_message()`` method which will
  565. provide the message in the current language.
  566. * The default error views now raise ``TemplateDoesNotExist`` if a nonexistent
  567. ``template_name`` is specified.
  568. * The unused ``choices`` keyword argument of the ``Select`` and
  569. ``SelectMultiple`` widgets' ``render()`` method is removed. The ``choices``
  570. argument of the ``render_options()`` method is also removed, making
  571. ``selected_choices`` the first argument.
  572. * Tests that violate deferrable database constraints will now error when run on
  573. a database that supports deferrable constraints.
  574. * Built-in management commands now use indexing of keys in ``options``, e.g.
  575. ``options['verbosity']``, instead of ``options.get()`` and no longer perform
  576. any type coercion. This could be a problem if you're calling commands using
  577. ``Command.execute()`` (which bypasses the argument parser that sets a default
  578. value) instead of :func:`~django.core.management.call_command`. Instead of
  579. calling ``Command.execute()``, pass the command object as the first argument
  580. to ``call_command()``.
  581. * :class:`~django.contrib.auth.backends.ModelBackend` and
  582. :class:`~django.contrib.auth.backends.RemoteUserBackend` now reject inactive
  583. users. This means that inactive users can't login and will be logged
  584. out if they are switched from ``is_active=True`` to ``False``. If you need
  585. the previous behavior, use the new
  586. :class:`~django.contrib.auth.backends.AllowAllUsersModelBackend` or
  587. :class:`~django.contrib.auth.backends.AllowAllUsersRemoteUserBackend`
  588. in :setting:`AUTHENTICATION_BACKENDS` instead.
  589. * In light of the previous change, the test client's
  590. :meth:`~django.test.Client.login()` method no longer always rejects inactive
  591. users but instead delegates this decision to the authentication backend.
  592. * :func:`django.views.i18n.set_language` may now return a 204 status code for
  593. AJAX requests.
  594. * The ``base_field`` attribute of
  595. :class:`~django.contrib.postgres.fields.RangeField` is now a type of field,
  596. not an instance of a field. If you have created a custom subclass of
  597. :class:`~django.contrib.postgres.fields.RangeField`, you should change the
  598. ``base_field`` attribute.
  599. * Middleware classes are now initialized when the server starts rather than
  600. during the first request.
  601. * If you override ``is_authenticated()`` or ``is_anonymous()`` in a custom user
  602. model, you must convert them to attributes or properties as described in
  603. :ref:`the deprecation note <user-is-auth-anon-deprecation>`.
  604. * When using :attr:`ModelAdmin.save_as=True
  605. <django.contrib.admin.ModelAdmin.save_as>`, the "Save as new" button now
  606. redirects to the change view for the new object instead of to the model's
  607. changelist. If you need the previous behavior, set the new
  608. :attr:`ModelAdmin.save_as_continue
  609. <django.contrib.admin.ModelAdmin.save_as_continue>` attribute to ``False``.
  610. * Required form fields now have the ``required`` HTML attribute. Set the
  611. :attr:`Form.use_required_attribute <django.forms.Form.use_required_attribute>`
  612. attribute to ``False`` to disable it. You could also add the ``novalidate``
  613. attribute to ``<form>`` if you don't want browser validation.
  614. * The WSGI handler no longer removes content of responses from ``HEAD``
  615. requests or responses with a ``status_code`` of 100-199, 204, or 304. Most
  616. Web servers already implement this behavior. Responses retrieved using the
  617. Django test client continue to have these "response fixes" applied.
  618. * ``Model.__init__()`` now receives ``django.db.models.DEFERRED`` as the value
  619. of deferred fields.
  620. * The ``Model._deferred`` attribute is removed as dynamic model classes when
  621. using ``QuerySet.defer()`` and ``only()`` is removed.
  622. * :meth:`Storage.save() <django.core.files.storage.Storage.save>` no longer
  623. replaces ``'\'`` with ``'/'``. This behavior is moved to
  624. :class:`~django.core.files.storage.FileSystemStorage` since this is a storage
  625. specific implementation detail. Any Windows user with a custom storage
  626. implementation that relies on this behavior will need to implement it in the
  627. custom storage's ``save()`` method.
  628. * Private :class:`~django.db.models.FileField` methods ``get_directory_name()``
  629. and ``get_filename()`` are no longer called (and are now deprecated) which is
  630. a backwards incompatible change for users overriding those methods on custom
  631. fields. To adapt such code, override ``FileField.generate_filename()`` or
  632. :meth:`Storage.generate_filename()
  633. <django.core.files.storage.Storage.generate_filename>` instead. It
  634. might be possible to use :attr:`~django.db.models.FileField.upload_to` also.
  635. * The subject of mail sent by ``AdminEmailHandler`` is no longer truncated at
  636. 989 characters. If you were counting on a limited length, truncate the subject
  637. yourself.
  638. .. _deprecated-features-1.10:
  639. Features deprecated in 1.10
  640. ===========================
  641. Direct assignment to a reverse foreign key or many-to-many relation
  642. -------------------------------------------------------------------
  643. Instead of assigning related objects using direct assignment::
  644. >>> new_list = [obj1, obj2, obj3]
  645. >>> e.related_set = new_list
  646. Use the :meth:`~django.db.models.fields.related.RelatedManager.set` method
  647. added in Django 1.9::
  648. >>> e.related_set.set([obj1, obj2, obj3])
  649. This prevents confusion about an assignment resulting in an implicit save.
  650. Non-timezone-aware :class:`~django.core.files.storage.Storage` API
  651. ------------------------------------------------------------------
  652. The old, non-timezone-aware methods ``accessed_time()``, ``created_time()``,
  653. and ``modified_time()`` are deprecated in favor of the new ``get_*_time()``
  654. methods.
  655. Third-party storage backends should implement the new methods and mark the old
  656. ones as deprecated. Until then, the new ``get_*_time()`` methods on the base
  657. :class:`~django.core.files.storage.Storage` class convert ``datetime``\s from
  658. the old methods as required and emit a deprecation warning as they do so.
  659. Third-party storage backends may retain the old methods as long as they
  660. wish to support earlier versions of Django.
  661. :mod:`django.contrib.gis`
  662. -------------------------
  663. * The ``get_srid()`` and ``set_srid()`` methods of
  664. :class:`~django.contrib.gis.geos.GEOSGeometry` are deprecated in favor
  665. of the :attr:`~django.contrib.gis.geos.GEOSGeometry.srid` property.
  666. * The ``get_x()``, ``set_x()``, ``get_y()``, ``set_y()``, ``get_z()``, and
  667. ``set_z()`` methods of :class:`~django.contrib.gis.geos.Point` are deprecated
  668. in favor of the ``x``, ``y``, and ``z`` properties.
  669. * The ``get_coords()`` and ``set_coords()`` methods of
  670. :class:`~django.contrib.gis.geos.Point` are deprecated in favor of the
  671. ``tuple`` property.
  672. * The ``cascaded_union`` property of
  673. :class:`~django.contrib.gis.geos.MultiPolygon` is deprecated in favor of the
  674. :attr:`~django.contrib.gis.geos.GEOSGeometry.unary_union` property.
  675. * The ``django.contrib.gis.utils.precision_wkt()`` function is deprecated in
  676. favor of :class:`~django.contrib.gis.geos.WKTWriter`.
  677. ``CommaSeparatedIntegerField`` model field
  678. ------------------------------------------
  679. ``CommaSeparatedIntegerField`` is deprecated in favor of
  680. :class:`~django.db.models.CharField` with the
  681. :func:`~django.core.validators.validate_comma_separated_integer_list`
  682. validator::
  683. from django.core.validators import validate_comma_separated_integer_list
  684. from django.db import models
  685. class MyModel(models.Model):
  686. numbers = models.CharField(..., validators=[validate_comma_separated_integer_list])
  687. If you're using Oracle, ``CharField`` uses a different database field type
  688. (``NVARCHAR2``) than ``CommaSeparatedIntegerField`` (``VARCHAR2``). Depending
  689. on your database settings, this might imply a different encoding, and thus a
  690. different length (in bytes) for the same contents. If your stored values are
  691. longer than the 4000 byte limit of ``NVARCHAR2``, you should use ``TextField``
  692. (``NCLOB``) instead. In this case, if you have any queries that group by the
  693. field (e.g. annotating the model with an aggregation or using ``distinct()``)
  694. you'll need to change them (to defer the field).
  695. Using a model name as a query lookup when ``default_related_name`` is set
  696. -------------------------------------------------------------------------
  697. Assume the following models::
  698. from django.db import models
  699. class Foo(models.Model):
  700. pass
  701. class Bar(models.Model):
  702. foo = models.ForeignKey(Foo)
  703. class Meta:
  704. default_related_name = 'bars'
  705. In older versions, :attr:`~django.db.models.Options.default_related_name`
  706. couldn't be used as a query lookup. This is fixed and support for the old
  707. lookup name is deprecated. For example, since ``default_related_name`` is set
  708. in model ``Bar``, instead of using the model name ``bar`` as the lookup::
  709. >>> bar = Bar.objects.get(pk=1)
  710. >>> Foo.objects.get(bar=bar)
  711. use the default_related_name ``bars``::
  712. >>> Foo.objects.get(bars=bar)
  713. .. _search-lookup-replacement:
  714. ``__search`` query lookup
  715. -------------------------
  716. The ``search`` lookup, which supports MySQL only and is extremely limited in
  717. features, is deprecated. Replace it with a custom lookup::
  718. from django.db import models
  719. class Search(models.Lookup):
  720. lookup_name = 'search'
  721. def as_mysql(self, compiler, connection):
  722. lhs, lhs_params = self.process_lhs(compiler, connection)
  723. rhs, rhs_params = self.process_rhs(compiler, connection)
  724. params = lhs_params + rhs_params
  725. return 'MATCH (%s) AGAINST (%s IN BOOLEAN MODE)' % (lhs, rhs), params
  726. models.CharField.register_lookup(Search)
  727. models.TextField.register_lookup(Search)
  728. .. _user-is-auth-anon-deprecation:
  729. Using ``User.is_authenticated()`` and ``User.is_anonymous()`` as methods
  730. ------------------------------------------------------------------------
  731. The ``is_authenticated()`` and ``is_anonymous()`` methods of
  732. :class:`~django.contrib.auth.models.AbstractBaseUser` and
  733. :class:`~django.contrib.auth.models.AnonymousUser` classes are now
  734. properties. They will still work as methods until Django 2.0, but all usage
  735. in Django now uses attribute access.
  736. For example, if you use
  737. :class:`~django.contrib.auth.middleware.AuthenticationMiddleware` and want
  738. to know whether the user is currently logged-in you would use::
  739. if request.user.is_authenticated:
  740. ... # Do something for logged-in users.
  741. else:
  742. ... # Do something for anonymous users.
  743. instead of ``request.user.is_authenticated()``.
  744. This change avoids accidental information leakage if you forget to call the
  745. method, e.g.::
  746. if request.user.is_authenticated:
  747. return sensitive_information
  748. If you override these methods in a custom user model, you must change them to
  749. properties or attributes.
  750. Custom manager classes available through ``prefetch_related`` must define a ``_apply_rel_filters()`` method
  751. -----------------------------------------------------------------------------------------------------------
  752. If you defined a custom manager class available through
  753. :meth:`~django.db.models.query.QuerySet.prefetch_related` you must make sure
  754. it defines a ``_apply_rel_filters()`` method.
  755. This method must accept a :class:`~django.db.models.query.QuerySet` instance
  756. as its single argument and return a filtered version of the queryset for the
  757. model instance the manager is bound to.
  758. The "escape" half of ``django.utils.safestring``
  759. ------------------------------------------------
  760. The ``mark_for_escaping()`` function and the classes it uses: ``EscapeData``,
  761. ``EscapeBytes``, ``EscapeText``, ``EscapeString``, and ``EscapeUnicode`` are
  762. deprecated.
  763. As a result, the "lazy" behavior of the ``escape`` filter (where it would
  764. always be applied as the last filter no matter where in the filter chain it
  765. appeared) is deprecated. The filter will change to immediately apply
  766. :func:`~django.utils.html.conditional_escape` in Django 2.0.
  767. Miscellaneous
  768. -------------
  769. * The ``makemigrations --exit`` option is deprecated in favor of the
  770. :option:`makemigrations --check` option.
  771. * ``django.utils.functional.allow_lazy()`` is deprecated in favor of the new
  772. :func:`~django.utils.functional.keep_lazy` function which can be used with a
  773. more natural decorator syntax.
  774. * The ``shell --plain`` option is deprecated in favor of ``-i python`` or
  775. ``--interface python``.
  776. * Importing from the ``django.core.urlresolvers`` module is deprecated in
  777. favor of its new location, :mod:`django.urls`.
  778. * The template ``Context.has_key()`` method is deprecated in favor of ``in``.
  779. * The private attribute ``virtual_fields`` of ``Model._meta`` is
  780. deprecated in favor of ``private_fields``.
  781. * The private keyword arguments ``virtual_only`` in
  782. ``Field.contribute_to_class()`` and ``virtual`` in
  783. ``Model._meta.add_field()`` are deprecated in favor of ``private_only``
  784. and ``private``, respectively.
  785. * The ``javascript_catalog()`` and ``json_catalog()`` views are deprecated in
  786. favor of class-based views :class:`~django.views.i18n.JavaScriptCatalog`
  787. and :class:`~django.views.i18n.JSONCatalog`.
  788. * In multi-table inheritance, implicit promotion of a ``OneToOneField`` to a
  789. ``parent_link`` is deprecated. Add ``parent_link=True`` to such fields.
  790. * The private API ``Widget._format_value()`` is made public and renamed to
  791. :meth:`~django.forms.Widget.format_value`. The old name will work
  792. through a deprecation period.
  793. * Private ``FileField`` methods ``get_directory_name()`` and ``get_filename()``
  794. are deprecated in favor of performing this work in
  795. :meth:`Storage.generate_filename()
  796. <django.core.files.storage.Storage.generate_filename>`).
  797. .. _removed-features-1.10:
  798. Features removed in 1.10
  799. ========================
  800. These features have reached the end of their deprecation cycle and so have been
  801. removed in Django 1.10 (please see the :ref:`deprecation timeline
  802. <deprecation-removed-in-1.10>` for more details):
  803. * Support for calling a ``SQLCompiler`` directly as an alias for calling its
  804. ``quote_name_unless_alias`` method is removed.
  805. * The ``cycle`` and ``firstof`` template tags are removed from the ``future``
  806. template tag library.
  807. * ``django.conf.urls.patterns()`` is removed.
  808. * Support for the ``prefix`` argument to
  809. ``django.conf.urls.i18n.i18n_patterns()`` is removed.
  810. * ``SimpleTestCase.urls`` is removed.
  811. * Using an incorrect count of unpacked values in the ``for`` template tag
  812. raises an exception rather than failing silently.
  813. * The ability to :func:`~django.urls.reverse` URLs using a dotted Python path
  814. is removed.
  815. * The ability to use a dotted Python path for the ``LOGIN_URL`` and
  816. ``LOGIN_REDIRECT_URL`` settings is removed.
  817. * Support for ``optparse`` is dropped for custom management commands.
  818. * The class ``django.core.management.NoArgsCommand`` is removed.
  819. * ``django.core.context_processors`` module is removed.
  820. * ``django.db.models.sql.aggregates`` module is removed.
  821. * ``django.contrib.gis.db.models.sql.aggregates`` module is removed.
  822. * The following methods and properties of ``django.db.sql.query.Query`` are
  823. removed:
  824. * Properties: ``aggregates`` and ``aggregate_select``
  825. * Methods: ``add_aggregate``, ``set_aggregate_mask``, and
  826. ``append_aggregate_mask``.
  827. * ``django.template.resolve_variable`` is removed.
  828. * The following private APIs are removed from
  829. :class:`django.db.models.options.Options` (``Model._meta``):
  830. * ``get_field_by_name()``
  831. * ``get_all_field_names()``
  832. * ``get_fields_with_model()``
  833. * ``get_concrete_fields_with_model()``
  834. * ``get_m2m_with_model()``
  835. * ``get_all_related_objects()``
  836. * ``get_all_related_objects_with_model()``
  837. * ``get_all_related_many_to_many_objects()``
  838. * ``get_all_related_m2m_objects_with_model()``
  839. * The ``error_message`` argument of ``django.forms.RegexField`` is removed.
  840. * The ``unordered_list`` filter no longer supports old style lists.
  841. * Support for string ``view`` arguments to ``url()`` is removed.
  842. * The backward compatible shim to rename ``django.forms.Form._has_changed()``
  843. to ``has_changed()`` is removed.
  844. * The ``removetags`` template filter is removed.
  845. * The ``remove_tags()`` and ``strip_entities()`` functions in
  846. ``django.utils.html`` is removed.
  847. * The ``is_admin_site`` argument to
  848. ``django.contrib.auth.views.password_reset()`` is removed.
  849. * ``django.db.models.field.subclassing.SubfieldBase`` is removed.
  850. * ``django.utils.checksums`` is removed.
  851. * The ``original_content_type_id`` attribute on
  852. ``django.contrib.admin.helpers.InlineAdminForm`` is removed.
  853. * The backwards compatibility shim to allow ``FormMixin.get_form()`` to be
  854. defined with no default value for its ``form_class`` argument is removed.
  855. * The following settings are removed:
  856. * ``ALLOWED_INCLUDE_ROOTS``
  857. * ``TEMPLATE_CONTEXT_PROCESSORS``
  858. * ``TEMPLATE_DEBUG``
  859. * ``TEMPLATE_DIRS``
  860. * ``TEMPLATE_LOADERS``
  861. * ``TEMPLATE_STRING_IF_INVALID``
  862. * The backwards compatibility alias ``django.template.loader.BaseLoader`` is
  863. removed.
  864. * Django template objects returned by
  865. :func:`~django.template.loader.get_template` and
  866. :func:`~django.template.loader.select_template` no longer accept a
  867. :class:`~django.template.Context` in their
  868. :meth:`~django.template.backends.base.Template.render()` method.
  869. * :doc:`Template response APIs </ref/template-response>` enforce the use of
  870. :class:`dict` and backend-dependent template objects instead of
  871. :class:`~django.template.Context` and :class:`~django.template.Template`
  872. respectively.
  873. * The ``current_app`` parameter for the following function and classes is
  874. removed:
  875. * ``django.shortcuts.render()``
  876. * ``django.template.Context()``
  877. * ``django.template.RequestContext()``
  878. * ``django.template.response.TemplateResponse()``
  879. * The ``dictionary`` and ``context_instance`` parameters for the following
  880. functions are removed:
  881. * ``django.shortcuts.render()``
  882. * ``django.shortcuts.render_to_response()``
  883. * ``django.template.loader.render_to_string()``
  884. * The ``dirs`` parameter for the following functions is removed:
  885. * ``django.template.loader.get_template()``
  886. * ``django.template.loader.select_template()``
  887. * ``django.shortcuts.render()``
  888. * ``django.shortcuts.render_to_response()``
  889. * Session verification is enabled regardless of whether or not
  890. ``'django.contrib.auth.middleware.SessionAuthenticationMiddleware'`` is in
  891. ``MIDDLEWARE_CLASSES``. ``SessionAuthenticationMiddleware`` no longer has
  892. any purpose and can be removed from ``MIDDLEWARE_CLASSES``. It's kept as
  893. a stub until Django 2.0 as a courtesy for users who don't read this note.
  894. * Private attribute ``django.db.models.Field.related`` is removed.
  895. * The ``--list`` option of the ``migrate`` management command is removed.
  896. * The ``ssi`` template tag is removed.
  897. * Support for the ``=`` comparison operator in the ``if`` template tag is
  898. removed.
  899. * The backwards compatibility shims to allow ``Storage.get_available_name()``
  900. and ``Storage.save()`` to be defined without a ``max_length`` argument are
  901. removed.
  902. * Support for the legacy ``%(<foo>)s`` syntax in ``ModelFormMixin.success_url``
  903. is removed.
  904. * ``GeoQuerySet`` aggregate methods ``collect()``, ``extent()``, ``extent3d()``,
  905. ``make_line()``, and ``unionagg()`` are removed.
  906. * The ability to specify ``ContentType.name`` when creating a content type
  907. instance is removed.
  908. * Support for the old signature of ``allow_migrate`` is removed.
  909. * Support for the syntax of ``{% cycle %}`` that uses comma-separated arguments
  910. is removed.
  911. * The warning that :class:`~django.core.signing.Signer` issued when given an
  912. invalid separator is now a ``ValueError``.