| 1 |
========================= |
| 2 |
Django 1.10 release notes |
| 3 |
========================= |
| 4 |
|
| 5 |
*August 1, 2016* |
| 6 |
|
| 7 |
Welcome to Django 1.10! |
| 8 |
|
| 9 |
These release notes cover the :ref:`new features <whats-new-1.10>`, as well as |
| 10 |
some :ref:`backwards incompatible changes <backwards-incompatible-1.10>` you'll |
| 11 |
want to be aware of when upgrading from Django 1.9 or older versions. We've |
| 12 |
:ref:`dropped some features <removed-features-1.10>` that have reached the end |
| 13 |
of their deprecation cycle, and we've :ref:`begun the deprecation process for |
| 14 |
some features <deprecated-features-1.10>`. |
| 15 |
|
| 16 |
See the :doc:`/howto/upgrade-version` guide if you're updating an existing |
| 17 |
project. |
| 18 |
|
| 19 |
Python compatibility |
| 20 |
==================== |
| 21 |
|
| 22 |
Like Django 1.9, Django 1.10 requires Python 2.7, 3.4, or 3.5. We **highly |
| 23 |
recommend** and only officially support the latest release of each series. |
| 24 |
|
| 25 |
.. _whats-new-1.10: |
| 26 |
|
| 27 |
What's new in Django 1.10 |
| 28 |
========================= |
| 29 |
|
| 30 |
Full text search for PostgreSQL |
| 31 |
------------------------------- |
| 32 |
|
| 33 |
``django.contrib.postgres`` now includes a :doc:`collection of database |
| 34 |
functions </ref/contrib/postgres/search>` to allow the use of the full text |
| 35 |
search engine. You can search across multiple fields in your relational |
| 36 |
database, combine the searches with other lookups, use different language |
| 37 |
configurations and weightings, and rank the results by relevance. |
| 38 |
|
| 39 |
It also now includes trigram support, using the :lookup:`trigram_similar` |
| 40 |
lookup, and the :class:`~django.contrib.postgres.search.TrigramSimilarity` and |
| 41 |
:class:`~django.contrib.postgres.search.TrigramDistance` expressions. |
| 42 |
|
| 43 |
New-style middleware |
| 44 |
-------------------- |
| 45 |
|
| 46 |
:doc:`A new style of middleware is introduced </topics/http/middleware>` to |
| 47 |
solve the lack of strict request/response layering of the old-style of |
| 48 |
middleware described in `DEP 0005 |
| 49 |
<https://github.com/django/deps/blob/main/final/0005-improved-middleware.rst>`_. |
| 50 |
You'll need to :ref:`adapt old, custom middleware <upgrading-middleware>` and |
| 51 |
switch from the ``MIDDLEWARE_CLASSES`` setting to the new :setting:`MIDDLEWARE` |
| 52 |
setting to take advantage of the improvements. |
| 53 |
|
| 54 |
Official support for Unicode usernames |
| 55 |
-------------------------------------- |
| 56 |
|
| 57 |
The :class:`~django.contrib.auth.models.User` model in ``django.contrib.auth`` |
| 58 |
originally only accepted ASCII letters and numbers in usernames. Although it |
| 59 |
wasn't a deliberate choice, Unicode characters have always been accepted when |
| 60 |
using Python 3. |
| 61 |
|
| 62 |
The username validator now explicitly accepts Unicode characters by |
| 63 |
default on Python 3 only. |
| 64 |
|
| 65 |
Custom user models may use the new |
| 66 |
:class:`~django.contrib.auth.validators.ASCIIUsernameValidator` or |
| 67 |
:class:`~django.contrib.auth.validators.UnicodeUsernameValidator`. |
| 68 |
|
| 69 |
Minor features |
| 70 |
-------------- |
| 71 |
|
| 72 |
:mod:`django.contrib.admin` |
| 73 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 74 |
|
| 75 |
* For sites running on a subpath, the default :attr:`URL for the "View site" |
| 76 |
link <django.contrib.admin.AdminSite.site_url>` at the top of each admin page |
| 77 |
will now point to ``request.META['SCRIPT_NAME']`` if set, instead of ``/``. |
| 78 |
|
| 79 |
* The success message that appears after adding or editing an object now |
| 80 |
contains a link to the object's change form. |
| 81 |
|
| 82 |
* All inline JavaScript is removed so you can enable the |
| 83 |
``Content-Security-Policy`` HTTP header if you wish. |
| 84 |
|
| 85 |
* The new :attr:`InlineModelAdmin.classes |
| 86 |
<django.contrib.admin.InlineModelAdmin.classes>` attribute allows specifying |
| 87 |
classes on inline fieldsets. Inlines with a ``collapse`` class will be |
| 88 |
initially collapsed and their header will have a small "show" link. |
| 89 |
|
| 90 |
* If a user doesn't have the add permission, the ``object-tools`` block on a |
| 91 |
model's changelist will now be rendered (without the add button). This makes |
| 92 |
it easier to add custom tools in this case. |
| 93 |
|
| 94 |
* The :class:`~django.contrib.admin.models.LogEntry` model now stores change |
| 95 |
messages in a JSON structure so that the message can be dynamically translated |
| 96 |
using the current active language. A new ``LogEntry.get_change_message()`` |
| 97 |
method is now the preferred way of retrieving the change message. |
| 98 |
|
| 99 |
* Selected objects for fields in ``ModelAdmin.raw_id_fields`` now have a link |
| 100 |
to object's change form. |
| 101 |
|
| 102 |
* Added "No date" and "Has date" choices for ``DateFieldListFilter`` if the |
| 103 |
field is nullable. |
| 104 |
|
| 105 |
* The jQuery library embedded in the admin is upgraded from version 2.1.4 to |
| 106 |
2.2.3. |
| 107 |
|
| 108 |
:mod:`django.contrib.auth` |
| 109 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 110 |
|
| 111 |
* Added support for the :ref:`Argon2 password hash <argon2_usage>`. It's |
| 112 |
recommended over PBKDF2, however, it's not the default as it requires a |
| 113 |
third-party library. |
| 114 |
|
| 115 |
* The default iteration count for the PBKDF2 password hasher has been increased |
| 116 |
by 25%. This backwards compatible change will not affect users who have |
| 117 |
subclassed ``django.contrib.auth.hashers.PBKDF2PasswordHasher`` to change the |
| 118 |
default value. |
| 119 |
|
| 120 |
* The ``django.contrib.auth.views.logout()`` view sends "no-cache" headers |
| 121 |
to prevent an issue where Safari caches redirects and prevents a user from |
| 122 |
being able to log out. |
| 123 |
|
| 124 |
* Added the optional ``backend`` argument to :func:`django.contrib.auth.login` |
| 125 |
to allow using it without credentials. |
| 126 |
|
| 127 |
* The new :setting:`LOGOUT_REDIRECT_URL` setting controls the redirect of the |
| 128 |
``django.contrib.auth.views.logout()`` view, if the view doesn't get a |
| 129 |
``next_page`` argument. |
| 130 |
|
| 131 |
* The new ``redirect_authenticated_user`` parameter for the |
| 132 |
``django.contrib.auth.views.login()`` view allows redirecting |
| 133 |
authenticated users visiting the login page. |
| 134 |
|
| 135 |
* The new :class:`~django.contrib.auth.backends.AllowAllUsersModelBackend` and |
| 136 |
:class:`~django.contrib.auth.backends.AllowAllUsersRemoteUserBackend` ignore |
| 137 |
the value of ``User.is_active``, while |
| 138 |
:class:`~django.contrib.auth.backends.ModelBackend` and |
| 139 |
:class:`~django.contrib.auth.backends.RemoteUserBackend` now reject inactive |
| 140 |
users. |
| 141 |
|
| 142 |
:mod:`django.contrib.gis` |
| 143 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 144 |
|
| 145 |
* :ref:`Distance lookups <distance-lookups>` now accept expressions as the |
| 146 |
distance value parameter. |
| 147 |
|
| 148 |
* The new :attr:`GEOSGeometry.unary_union |
| 149 |
<django.contrib.gis.geos.GEOSGeometry.unary_union>` property computes the |
| 150 |
union of all the elements of this geometry. |
| 151 |
|
| 152 |
* Added the :meth:`GEOSGeometry.covers() |
| 153 |
<django.contrib.gis.geos.GEOSGeometry.covers>` binary predicate. |
| 154 |
|
| 155 |
* Added the :meth:`GDALBand.statistics() |
| 156 |
<django.contrib.gis.gdal.GDALBand.statistics>` method and |
| 157 |
:attr:`~django.contrib.gis.gdal.GDALBand.mean` |
| 158 |
and :attr:`~django.contrib.gis.gdal.GDALBand.std` attributes. |
| 159 |
|
| 160 |
* Added support for the :class:`~django.contrib.gis.db.models.MakeLine` |
| 161 |
aggregate and :class:`~django.contrib.gis.db.models.functions.GeoHash` |
| 162 |
function on SpatiaLite. |
| 163 |
|
| 164 |
* Added support for the |
| 165 |
:class:`~django.contrib.gis.db.models.functions.Difference`, |
| 166 |
:class:`~django.contrib.gis.db.models.functions.Intersection`, and |
| 167 |
:class:`~django.contrib.gis.db.models.functions.SymDifference` |
| 168 |
functions on MySQL. |
| 169 |
|
| 170 |
* Added support for instantiating empty GEOS geometries. |
| 171 |
|
| 172 |
* The new :attr:`~django.contrib.gis.geos.WKTWriter.trim` and |
| 173 |
:attr:`~django.contrib.gis.geos.WKTWriter.precision` properties |
| 174 |
of :class:`~django.contrib.gis.geos.WKTWriter` allow controlling |
| 175 |
output of the fractional part of the coordinates in WKT. |
| 176 |
|
| 177 |
* Added the :attr:`LineString.closed |
| 178 |
<django.contrib.gis.geos.LineString.closed>` and |
| 179 |
:attr:`MultiLineString.closed |
| 180 |
<django.contrib.gis.geos.MultiLineString.closed>` properties. |
| 181 |
|
| 182 |
* The :doc:`GeoJSON serializer </ref/contrib/gis/serializers>` now outputs the |
| 183 |
primary key of objects in the ``properties`` dictionary if specific fields |
| 184 |
aren't specified. |
| 185 |
|
| 186 |
* The ability to replicate input data on the :meth:`GDALBand.data() |
| 187 |
<django.contrib.gis.gdal.GDALBand.data>` method was added. Band data can |
| 188 |
now be updated with repeated values efficiently. |
| 189 |
|
| 190 |
* Added database functions |
| 191 |
:class:`~django.contrib.gis.db.models.functions.IsValid` and |
| 192 |
:class:`~django.contrib.gis.db.models.functions.MakeValid`, as well as the |
| 193 |
:lookup:`isvalid` lookup, all for PostGIS. This allows filtering and |
| 194 |
repairing invalid geometries on the database side. |
| 195 |
|
| 196 |
* Added raster support for all :doc:`spatial lookups |
| 197 |
</ref/contrib/gis/geoquerysets>`. |
| 198 |
|
| 199 |
:mod:`django.contrib.postgres` |
| 200 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 201 |
|
| 202 |
* For convenience, :class:`~django.contrib.postgres.fields.HStoreField` now |
| 203 |
casts its keys and values to strings. |
| 204 |
|
| 205 |
:mod:`django.contrib.sessions` |
| 206 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 207 |
|
| 208 |
* The :djadmin:`clearsessions` management command now removes file-based |
| 209 |
sessions. |
| 210 |
|
| 211 |
:mod:`django.contrib.sites` |
| 212 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 213 |
|
| 214 |
* The :class:`~django.contrib.sites.models.Site` model now supports |
| 215 |
:ref:`natural keys <topics-serialization-natural-keys>`. |
| 216 |
|
| 217 |
:mod:`django.contrib.staticfiles` |
| 218 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 219 |
|
| 220 |
* The :ttag:`static` template tag now uses ``django.contrib.staticfiles`` |
| 221 |
if it's in ``INSTALLED_APPS``. This is especially useful for third-party apps |
| 222 |
which can now always use ``{% load static %}`` (instead of |
| 223 |
``{% load staticfiles %}`` or ``{% load static from staticfiles %}``) and |
| 224 |
not worry about whether or not the ``staticfiles`` app is installed. |
| 225 |
|
| 226 |
* You can :ref:`more easily customize <customize-staticfiles-ignore-patterns>` |
| 227 |
the ``collectstatic --ignore`` option with a custom ``AppConfig``. |
| 228 |
|
| 229 |
Cache |
| 230 |
~~~~~ |
| 231 |
|
| 232 |
* The file-based cache backend now uses the highest pickling protocol. |
| 233 |
|
| 234 |
CSRF |
| 235 |
~~~~ |
| 236 |
|
| 237 |
* The default :setting:`CSRF_FAILURE_VIEW`, ``views.csrf.csrf_failure()`` now |
| 238 |
accepts an optional ``template_name`` parameter, defaulting to |
| 239 |
``'403_csrf.html'``, to control the template used to render the page. |
| 240 |
|
| 241 |
* To protect against `BREACH`_ attacks, the CSRF protection mechanism now |
| 242 |
changes the form token value on every request (while keeping an invariant |
| 243 |
secret which can be used to validate the different tokens). |
| 244 |
|
| 245 |
.. _BREACH: https://www.breachattack.com/ |
| 246 |
|
| 247 |
Database backends |
| 248 |
~~~~~~~~~~~~~~~~~ |
| 249 |
|
| 250 |
* Temporal data subtraction was unified on all backends. |
| 251 |
|
| 252 |
* If the database supports it, backends can set |
| 253 |
``DatabaseFeatures.can_return_ids_from_bulk_insert=True`` and implement |
| 254 |
``DatabaseOperations.fetch_returned_insert_ids()`` to set primary keys |
| 255 |
on objects created using ``QuerySet.bulk_create()``. |
| 256 |
|
| 257 |
* Added keyword arguments to the ``as_sql()`` methods of various expressions |
| 258 |
(``Func``, ``When``, ``Case``, and ``OrderBy``) to allow database backends to |
| 259 |
customize them without mutating ``self``, which isn't safe when using |
| 260 |
different database backends. See the ``arg_joiner`` and ``**extra_context`` |
| 261 |
parameters of :meth:`Func.as_sql() <django.db.models.Func.as_sql>` for an |
| 262 |
example. |
| 263 |
|
| 264 |
File Storage |
| 265 |
~~~~~~~~~~~~ |
| 266 |
|
| 267 |
* Storage backends now present a timezone-aware API with new methods |
| 268 |
:meth:`~django.core.files.storage.Storage.get_accessed_time`, |
| 269 |
:meth:`~django.core.files.storage.Storage.get_created_time`, and |
| 270 |
:meth:`~django.core.files.storage.Storage.get_modified_time`. They return a |
| 271 |
timezone-aware ``datetime`` if :setting:`USE_TZ` is ``True`` and a naive |
| 272 |
``datetime`` in the local timezone otherwise. |
| 273 |
|
| 274 |
* The new :meth:`Storage.generate_filename() |
| 275 |
<django.core.files.storage.Storage.generate_filename>` method makes it easier |
| 276 |
to implement custom storages that don't use the ``os.path`` calls previously |
| 277 |
in :class:`~django.db.models.FileField`. |
| 278 |
|
| 279 |
Forms |
| 280 |
~~~~~ |
| 281 |
|
| 282 |
* Form and widget ``Media`` is now served using |
| 283 |
:mod:`django.contrib.staticfiles` if installed. |
| 284 |
|
| 285 |
* The ``<input>`` tag rendered by :class:`~django.forms.CharField` now includes |
| 286 |
a ``minlength`` attribute if the field has a ``min_length``. |
| 287 |
|
| 288 |
* Required form fields now have the ``required`` HTML attribute. Set the new |
| 289 |
:attr:`Form.use_required_attribute <django.forms.Form.use_required_attribute>` |
| 290 |
attribute to ``False`` to disable it. The ``required`` attribute isn't |
| 291 |
included on forms of formsets because the browser validation may not be |
| 292 |
correct when adding and deleting formsets. |
| 293 |
|
| 294 |
Generic Views |
| 295 |
~~~~~~~~~~~~~ |
| 296 |
|
| 297 |
* The :class:`~django.views.generic.base.View` class can now be imported from |
| 298 |
``django.views``. |
| 299 |
|
| 300 |
Internationalization |
| 301 |
~~~~~~~~~~~~~~~~~~~~ |
| 302 |
|
| 303 |
* The :func:`~django.conf.urls.i18n.i18n_patterns` helper function can now be |
| 304 |
used in a root URLConf specified using :attr:`request.urlconf |
| 305 |
<django.http.HttpRequest.urlconf>`. |
| 306 |
|
| 307 |
* By setting the new ``prefix_default_language`` parameter for |
| 308 |
:func:`~django.conf.urls.i18n.i18n_patterns` to ``False``, you can allow |
| 309 |
accessing the default language without a URL prefix. |
| 310 |
|
| 311 |
* :func:`~django.views.i18n.set_language` now returns a 204 status code (No |
| 312 |
Content) for AJAX requests when there is no ``next`` parameter in ``POST`` or |
| 313 |
``GET``. |
| 314 |
|
| 315 |
* The :class:`~django.views.i18n.JavaScriptCatalog` and |
| 316 |
:class:`~django.views.i18n.JSONCatalog` class-based views supersede the |
| 317 |
deprecated ``javascript_catalog()`` and ``json_catalog()`` function-based |
| 318 |
views. The new views are almost equivalent to the old ones except that by |
| 319 |
default the new views collect all JavaScript strings in the ``djangojs`` |
| 320 |
translation domain from all installed apps rather than only the JavaScript |
| 321 |
strings from :setting:`LOCALE_PATHS`. |
| 322 |
|
| 323 |
Management Commands |
| 324 |
~~~~~~~~~~~~~~~~~~~ |
| 325 |
|
| 326 |
* :func:`~django.core.management.call_command` now returns the value returned |
| 327 |
from the ``command.handle()`` method. |
| 328 |
|
| 329 |
* The new :option:`check --fail-level` option allows specifying the message |
| 330 |
level that will cause the command to exit with a non-zero status. |
| 331 |
|
| 332 |
* The new :option:`makemigrations --check` option makes the command exit |
| 333 |
with a non-zero status when model changes without migrations are detected. |
| 334 |
|
| 335 |
* :djadmin:`makemigrations` now displays the path to the migration files that |
| 336 |
it generates. |
| 337 |
|
| 338 |
* The :option:`shell --interface` option now accepts ``python`` to force use of |
| 339 |
the "plain" Python interpreter. |
| 340 |
|
| 341 |
* The new :option:`shell --command` option lets you run a command as Django and |
| 342 |
exit, instead of opening the interactive shell. |
| 343 |
|
| 344 |
* Added a warning to :djadmin:`dumpdata` if a proxy model is specified (which |
| 345 |
results in no output) without its concrete parent. |
| 346 |
|
| 347 |
* The new :attr:`BaseCommand.requires_migrations_checks |
| 348 |
<django.core.management.BaseCommand.requires_migrations_checks>` attribute |
| 349 |
may be set to ``True`` if you want your command to print a warning, like |
| 350 |
:djadmin:`runserver` does, if the set of migrations on disk don't match the |
| 351 |
migrations in the database. |
| 352 |
|
| 353 |
* To assist with testing, :func:`~django.core.management.call_command` now |
| 354 |
accepts a command object as the first argument. |
| 355 |
|
| 356 |
* The :djadmin:`shell` command supports tab completion on systems using |
| 357 |
``libedit``, e.g. macOS. |
| 358 |
|
| 359 |
* The :djadmin:`inspectdb` command lets you choose what tables should be |
| 360 |
inspected by specifying their names as arguments. |
| 361 |
|
| 362 |
Migrations |
| 363 |
~~~~~~~~~~ |
| 364 |
|
| 365 |
* Added support for serialization of ``enum.Enum`` objects. |
| 366 |
|
| 367 |
* Added the ``elidable`` argument to the |
| 368 |
:class:`~django.db.migrations.operations.RunSQL` and |
| 369 |
:class:`~django.db.migrations.operations.RunPython` operations to allow them |
| 370 |
to be removed when squashing migrations. |
| 371 |
|
| 372 |
* Added support for :ref:`non-atomic migrations <non-atomic-migrations>` by |
| 373 |
setting the ``atomic`` attribute on a ``Migration``. |
| 374 |
|
| 375 |
* The ``migrate`` and ``makemigrations`` commands now :ref:`check for a |
| 376 |
consistent migration history <migration-history-consistency>`. If they find |
| 377 |
some unapplied dependencies of an applied migration, |
| 378 |
``InconsistentMigrationHistory`` is raised. |
| 379 |
|
| 380 |
* The :func:`~django.db.models.signals.pre_migrate` and |
| 381 |
:func:`~django.db.models.signals.post_migrate` signals now dispatch their |
| 382 |
migration ``plan`` and ``apps``. |
| 383 |
|
| 384 |
Models |
| 385 |
~~~~~~ |
| 386 |
|
| 387 |
* Reverse foreign keys from proxy models are now propagated to their |
| 388 |
concrete class. The reverse relation attached by a |
| 389 |
:class:`~django.db.models.ForeignKey` pointing to a proxy model is now |
| 390 |
accessible as a descriptor on the proxied model class and may be referenced in |
| 391 |
queryset filtering. |
| 392 |
|
| 393 |
* The new :meth:`Field.rel_db_type() <django.db.models.Field.rel_db_type>` |
| 394 |
method returns the database column data type for fields such as ``ForeignKey`` |
| 395 |
and ``OneToOneField`` that point to another field. |
| 396 |
|
| 397 |
* The :attr:`~django.db.models.Func.arity` class attribute is added to |
| 398 |
:class:`~django.db.models.Func`. This attribute can be used to set the number |
| 399 |
of arguments the function accepts. |
| 400 |
|
| 401 |
* Added :class:`~django.db.models.BigAutoField` which acts much like an |
| 402 |
:class:`~django.db.models.AutoField` except that it is guaranteed |
| 403 |
to fit numbers from ``1`` to ``9223372036854775807``. |
| 404 |
|
| 405 |
* :meth:`QuerySet.in_bulk() <django.db.models.query.QuerySet.in_bulk>` |
| 406 |
may be called without any arguments to return all objects in the queryset. |
| 407 |
|
| 408 |
* :attr:`~django.db.models.ForeignKey.related_query_name` now supports |
| 409 |
app label and class interpolation using the ``'%(app_label)s'`` and |
| 410 |
``'%(class)s'`` strings. |
| 411 |
|
| 412 |
* Allowed overriding model fields inherited from abstract base classes. |
| 413 |
|
| 414 |
* The :func:`~django.db.models.prefetch_related_objects` function is now a |
| 415 |
public API. |
| 416 |
|
| 417 |
* :meth:`QuerySet.bulk_create() <django.db.models.query.QuerySet.bulk_create>` |
| 418 |
sets the primary key on objects when using PostgreSQL. |
| 419 |
|
| 420 |
* Added the :class:`~django.db.models.functions.Cast` database function. |
| 421 |
|
| 422 |
* A proxy model may now inherit multiple proxy models that share a common |
| 423 |
non-abstract parent class. |
| 424 |
|
| 425 |
* Added :class:`~django.db.models.functions.Extract` functions to extract |
| 426 |
datetime components as integers, such as year and hour. |
| 427 |
|
| 428 |
* Added :class:`~django.db.models.functions.Trunc` functions to truncate a date |
| 429 |
or datetime to a significant component. They enable queries like |
| 430 |
sales-per-day or sales-per-hour. |
| 431 |
|
| 432 |
* ``Model.__init__()`` now sets values of virtual fields from its keyword |
| 433 |
arguments. |
| 434 |
|
| 435 |
* The new :attr:`Meta.base_manager_name |
| 436 |
<django.db.models.Options.base_manager_name>` and |
| 437 |
:attr:`Meta.default_manager_name |
| 438 |
<django.db.models.Options.default_manager_name>` options allow controlling |
| 439 |
the :attr:`~django.db.models.Model._base_manager` and |
| 440 |
:attr:`~django.db.models.Model._default_manager`, respectively. |
| 441 |
|
| 442 |
Requests and Responses |
| 443 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 444 |
|
| 445 |
* Added ``request.user`` to the debug view. |
| 446 |
|
| 447 |
* Added :class:`~django.http.HttpResponse` methods |
| 448 |
:meth:`~django.http.HttpResponse.readable()` and |
| 449 |
:meth:`~django.http.HttpResponse.seekable()` to make an instance a |
| 450 |
stream-like object and allow wrapping it with :py:class:`io.TextIOWrapper`. |
| 451 |
|
| 452 |
* Added the :attr:`HttpRequest.content_type |
| 453 |
<django.http.HttpRequest.content_type>` and |
| 454 |
:attr:`~django.http.HttpRequest.content_params` attributes which are |
| 455 |
parsed from the ``CONTENT_TYPE`` header. |
| 456 |
|
| 457 |
* The parser for ``request.COOKIES`` is simplified to better match the behavior |
| 458 |
of browsers. ``request.COOKIES`` may now contain cookies that are invalid |
| 459 |
according to :rfc:`6265` but are possible to set via ``document.cookie``. |
| 460 |
|
| 461 |
Serialization |
| 462 |
~~~~~~~~~~~~~ |
| 463 |
|
| 464 |
* The ``django.core.serializers.json.DjangoJSONEncoder`` now knows how to |
| 465 |
serialize lazy strings, typically used for translatable content. |
| 466 |
|
| 467 |
Templates |
| 468 |
~~~~~~~~~ |
| 469 |
|
| 470 |
* Added the ``autoescape`` option to the |
| 471 |
:class:`~django.template.backends.django.DjangoTemplates` backend and the |
| 472 |
:class:`~django.template.Engine` class. |
| 473 |
|
| 474 |
* Added the ``is`` and ``is not`` comparison operators to the :ttag:`if` tag. |
| 475 |
|
| 476 |
* Allowed :tfilter:`dictsort` to order a list of lists by an element at a |
| 477 |
specified index. |
| 478 |
|
| 479 |
* The :func:`~django.template.context_processors.debug` context processor |
| 480 |
contains queries for all database aliases instead of only the default alias. |
| 481 |
|
| 482 |
* Added relative path support for string arguments of the :ttag:`extends` and |
| 483 |
:ttag:`include` template tags. |
| 484 |
|
| 485 |
Tests |
| 486 |
~~~~~ |
| 487 |
|
| 488 |
* To better catch bugs, :class:`~django.test.TestCase` now checks deferrable |
| 489 |
database constraints at the end of each test. |
| 490 |
|
| 491 |
* Tests and test cases can be :ref:`marked with tags <topics-tagging-tests>` |
| 492 |
and run selectively with the new :option:`test --tag` and :option:`test |
| 493 |
--exclude-tag` options. |
| 494 |
|
| 495 |
* You can now login and use sessions with the test client even if |
| 496 |
:mod:`django.contrib.sessions` is not in :setting:`INSTALLED_APPS`. |
| 497 |
|
| 498 |
URLs |
| 499 |
~~~~ |
| 500 |
|
| 501 |
* An addition in :func:`django.setup()` allows URL resolving that happens |
| 502 |
outside of the request/response cycle (e.g. in management commands and |
| 503 |
standalone scripts) to take :setting:`FORCE_SCRIPT_NAME` into account when it |
| 504 |
is set. |
| 505 |
|
| 506 |
Validators |
| 507 |
~~~~~~~~~~ |
| 508 |
|
| 509 |
* :class:`~django.core.validators.URLValidator` now limits the length of |
| 510 |
domain name labels to 63 characters and the total length of domain |
| 511 |
names to 253 characters per :rfc:`1034`. |
| 512 |
|
| 513 |
* :func:`~django.core.validators.int_list_validator` now accepts an optional |
| 514 |
``allow_negative`` boolean parameter, defaulting to ``False``, to allow |
| 515 |
negative integers. |
| 516 |
|
| 517 |
.. _backwards-incompatible-1.10: |
| 518 |
|
| 519 |
Backwards incompatible changes in 1.10 |
| 520 |
====================================== |
| 521 |
|
| 522 |
.. warning:: |
| 523 |
|
| 524 |
In addition to the changes outlined in this section, be sure to review the |
| 525 |
:ref:`removed-features-1.10` for the features that have reached the end of |
| 526 |
their deprecation cycle and therefore been removed. If you haven't updated |
| 527 |
your code within the deprecation timeline for a given feature, its removal |
| 528 |
may appear as a backwards incompatible change. |
| 529 |
|
| 530 |
Database backend API |
| 531 |
-------------------- |
| 532 |
|
| 533 |
* GIS's ``AreaField`` uses an unspecified underlying numeric type that could in |
| 534 |
practice be any numeric Python type. ``decimal.Decimal`` values retrieved |
| 535 |
from the database are now converted to ``float`` to make it easier to combine |
| 536 |
them with values used by the GIS libraries. |
| 537 |
|
| 538 |
* In order to enable temporal subtraction you must set the |
| 539 |
``supports_temporal_subtraction`` database feature flag to ``True`` and |
| 540 |
implement the ``DatabaseOperations.subtract_temporals()`` method. This |
| 541 |
method should return the SQL and parameters required to compute the |
| 542 |
difference in microseconds between the ``lhs`` and ``rhs`` arguments in the |
| 543 |
datatype used to store :class:`~django.db.models.DurationField`. |
| 544 |
|
| 545 |
``select_related()`` prohibits non-relational fields for nested relations |
| 546 |
------------------------------------------------------------------------- |
| 547 |
|
| 548 |
Django 1.8 added validation for non-relational fields in ``select_related()``: |
| 549 |
|
| 550 |
.. code-block:: pycon |
| 551 |
|
| 552 |
>>> Book.objects.select_related("title") |
| 553 |
Traceback (most recent call last): |
| 554 |
... |
| 555 |
FieldError: Non-relational field given in select_related: 'title' |
| 556 |
|
| 557 |
But it didn't prohibit nested non-relation fields as it does now: |
| 558 |
|
| 559 |
.. code-block:: pycon |
| 560 |
|
| 561 |
>>> Book.objects.select_related("author__name") |
| 562 |
Traceback (most recent call last): |
| 563 |
... |
| 564 |
FieldError: Non-relational field given in select_related: 'name' |
| 565 |
|
| 566 |
``_meta.get_fields()`` returns consistent reverse fields for proxy models |
| 567 |
------------------------------------------------------------------------- |
| 568 |
|
| 569 |
Before Django 1.10, the :meth:`~django.db.models.options.Options.get_fields` |
| 570 |
method returned different reverse fields when called on a proxy model compared |
| 571 |
to its proxied concrete class. This inconsistency was fixed by returning the |
| 572 |
full set of fields pointing to a concrete class or one of its proxies in both |
| 573 |
cases. |
| 574 |
|
| 575 |
:attr:`AbstractUser.username <django.contrib.auth.models.User.username>` ``max_length`` increased to 150 |
| 576 |
-------------------------------------------------------------------------------------------------------- |
| 577 |
|
| 578 |
A migration for :attr:`django.contrib.auth.models.User.username` is included. |
| 579 |
If you have a custom user model inheriting from ``AbstractUser``, you'll need |
| 580 |
to generate and apply a database migration for your user model. |
| 581 |
|
| 582 |
We considered an increase to 254 characters to more easily allow the use of |
| 583 |
email addresses (which are limited to 254 characters) as usernames but rejected |
| 584 |
it due to a MySQL limitation. When using the ``utf8mb4`` encoding (recommended |
| 585 |
for proper Unicode support), MySQL can only create unique indexes with 191 |
| 586 |
characters by default. Therefore, if you need a longer length, please use a |
| 587 |
custom user model. |
| 588 |
|
| 589 |
If you want to preserve the 30 character limit for usernames, use a custom form |
| 590 |
when creating a user or changing usernames:: |
| 591 |
|
| 592 |
from django.contrib.auth.forms import UserCreationForm |
| 593 |
|
| 594 |
|
| 595 |
class MyUserCreationForm(UserCreationForm): |
| 596 |
username = forms.CharField( |
| 597 |
max_length=30, |
| 598 |
help_text="Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.", |
| 599 |
) |
| 600 |
|
| 601 |
If you wish to keep this restriction in the admin, set ``UserAdmin.add_form`` |
| 602 |
to use this form:: |
| 603 |
|
| 604 |
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin |
| 605 |
from django.contrib.auth.models import User |
| 606 |
|
| 607 |
|
| 608 |
class UserAdmin(BaseUserAdmin): |
| 609 |
add_form = MyUserCreationForm |
| 610 |
|
| 611 |
|
| 612 |
admin.site.unregister(User) |
| 613 |
admin.site.register(User, UserAdmin) |
| 614 |
|
| 615 |
Dropped support for PostgreSQL 9.1 |
| 616 |
---------------------------------- |
| 617 |
|
| 618 |
Upstream support for PostgreSQL 9.1 ends in September 2016. As a consequence, |
| 619 |
Django 1.10 sets PostgreSQL 9.2 as the minimum version it officially supports. |
| 620 |
|
| 621 |
``runserver`` output goes through logging |
| 622 |
----------------------------------------- |
| 623 |
|
| 624 |
Request and response handling of the ``runserver`` command is sent to the |
| 625 |
:ref:`django-server-logger` logger instead of to ``sys.stderr``. If you |
| 626 |
disable Django's logging configuration or override it with your own, you'll |
| 627 |
need to add the appropriate logging configuration if you want to see that |
| 628 |
output:: |
| 629 |
|
| 630 |
LOGGING = { |
| 631 |
# ... |
| 632 |
"formatters": { |
| 633 |
"django.server": { |
| 634 |
"()": "django.utils.log.ServerFormatter", |
| 635 |
"format": "[%(server_time)s] %(message)s", |
| 636 |
} |
| 637 |
}, |
| 638 |
"handlers": { |
| 639 |
"django.server": { |
| 640 |
"level": "INFO", |
| 641 |
"class": "logging.StreamHandler", |
| 642 |
"formatter": "django.server", |
| 643 |
}, |
| 644 |
}, |
| 645 |
"loggers": { |
| 646 |
"django.server": { |
| 647 |
"handlers": ["django.server"], |
| 648 |
"level": "INFO", |
| 649 |
"propagate": False, |
| 650 |
} |
| 651 |
}, |
| 652 |
} |
| 653 |
|
| 654 |
``auth.CustomUser`` and ``auth.ExtensionUser`` test models were removed |
| 655 |
----------------------------------------------------------------------- |
| 656 |
|
| 657 |
Since the introduction of migrations for the contrib apps in Django 1.8, the |
| 658 |
tables of these custom user test models were not created anymore making them |
| 659 |
unusable in a testing context. |
| 660 |
|
| 661 |
Apps registry is no longer auto-populated when unpickling models outside of Django |
| 662 |
---------------------------------------------------------------------------------- |
| 663 |
|
| 664 |
The apps registry is no longer auto-populated when unpickling models. This was |
| 665 |
added in Django 1.7.2 as an attempt to allow unpickling models outside of |
| 666 |
Django, such as in an RQ worker, without calling ``django.setup()``, but it |
| 667 |
creates the possibility of a deadlock. To adapt your code in the case of RQ, |
| 668 |
you can `provide your own worker script <https://python-rq.org/docs/workers/>`_ |
| 669 |
that calls ``django.setup()``. |
| 670 |
|
| 671 |
Removed null assignment check for non-null foreign key fields |
| 672 |
------------------------------------------------------------- |
| 673 |
|
| 674 |
In older versions, assigning ``None`` to a non-nullable ``ForeignKey`` or |
| 675 |
``OneToOneField`` raised ``ValueError('Cannot assign None: "model.field" does |
| 676 |
not allow null values.')``. For consistency with other model fields which don't |
| 677 |
have a similar check, this check is removed. |
| 678 |
|
| 679 |
Removed weak password hashers from the default ``PASSWORD_HASHERS`` setting |
| 680 |
--------------------------------------------------------------------------- |
| 681 |
|
| 682 |
Django 0.90 stored passwords as unsalted MD5. Django 0.91 added support for |
| 683 |
salted SHA1 with automatic upgrade of passwords when a user logs in. Django 1.4 |
| 684 |
added PBKDF2 as the default password hasher. |
| 685 |
|
| 686 |
If you have an old Django project with MD5 or SHA1 (even salted) encoded |
| 687 |
passwords, be aware that these can be cracked fairly easily with today's |
| 688 |
hardware. To make Django users acknowledge continued use of weak hashers, the |
| 689 |
following hashers are removed from the default :setting:`PASSWORD_HASHERS` |
| 690 |
setting: |
| 691 |
|
| 692 |
* ``"django.contrib.auth.hashers.SHA1PasswordHasher"`` |
| 693 |
* ``"django.contrib.auth.hashers.MD5PasswordHasher"`` |
| 694 |
* ``"django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher"`` |
| 695 |
* ``"django.contrib.auth.hashers.UnsaltedMD5PasswordHasher"`` |
| 696 |
* ``"django.contrib.auth.hashers.CryptPasswordHasher"`` |
| 697 |
|
| 698 |
Consider using a :ref:`wrapped password hasher <wrapping-password-hashers>` to |
| 699 |
strengthen the hashes in your database. If that's not feasible, add the |
| 700 |
:setting:`PASSWORD_HASHERS` setting to your project and add back any hashers |
| 701 |
that you need. |
| 702 |
|
| 703 |
You can check if your database has any of the removed hashers like this:: |
| 704 |
|
| 705 |
from django.contrib.auth import get_user_model |
| 706 |
|
| 707 |
User = get_user_model() |
| 708 |
|
| 709 |
# Unsalted MD5/SHA1: |
| 710 |
User.objects.filter(password__startswith="md5$$") |
| 711 |
User.objects.filter(password__startswith="sha1$$") |
| 712 |
# Salted MD5/SHA1: |
| 713 |
User.objects.filter(password__startswith="md5$").exclude(password__startswith="md5$$") |
| 714 |
User.objects.filter(password__startswith="sha1$").exclude(password__startswith="sha1$$") |
| 715 |
# Crypt hasher: |
| 716 |
User.objects.filter(password__startswith="crypt$$") |
| 717 |
|
| 718 |
from django.db.models import CharField |
| 719 |
from django.db.models.functions import Length |
| 720 |
|
| 721 |
CharField.register_lookup(Length) |
| 722 |
# Unsalted MD5 passwords might not have an 'md5$$' prefix: |
| 723 |
User.objects.filter(password__length=32) |
| 724 |
|
| 725 |
``Field.get_prep_lookup()`` and ``Field.get_db_prep_lookup()`` methods are removed |
| 726 |
---------------------------------------------------------------------------------- |
| 727 |
|
| 728 |
If you have a custom field that implements either of these methods, register a |
| 729 |
custom lookup for it. For example:: |
| 730 |
|
| 731 |
from django.db.models import Field |
| 732 |
from django.db.models.lookups import Exact |
| 733 |
|
| 734 |
|
| 735 |
class MyField(Field): ... |
| 736 |
|
| 737 |
|
| 738 |
class MyFieldExact(Exact): |
| 739 |
def get_prep_lookup(self): |
| 740 |
# do_custom_stuff_for_myfield |
| 741 |
... |
| 742 |
|
| 743 |
|
| 744 |
MyField.register_lookup(MyFieldExact) |
| 745 |
|
| 746 |
:mod:`django.contrib.gis` |
| 747 |
------------------------- |
| 748 |
|
| 749 |
* Support for SpatiaLite < 3.0 and GEOS < 3.3 is dropped. |
| 750 |
|
| 751 |
* The ``add_postgis_srs()`` backwards compatibility alias for |
| 752 |
``django.contrib.gis.utils.add_srs_entry()`` is removed. |
| 753 |
|
| 754 |
* On Oracle/GIS, the :class:`~django.contrib.gis.db.models.functions.Area` |
| 755 |
aggregate function now returns a ``float`` instead of ``decimal.Decimal``. |
| 756 |
(It's still wrapped in a measure of square meters.) |
| 757 |
|
| 758 |
* The default :class:`~django.contrib.gis.geos.GEOSGeometry` representation (WKT |
| 759 |
output) is trimmed by default. That is, instead of |
| 760 |
``POINT (23.0000000000000000 5.5000000000000000)``, you'll get |
| 761 |
``POINT (23 5.5)``. |
| 762 |
|
| 763 |
Maximum size of a request body and the number of GET/POST parameters is limited |
| 764 |
------------------------------------------------------------------------------- |
| 765 |
|
| 766 |
Two new settings help mitigate denial-of-service attacks via large requests: |
| 767 |
|
| 768 |
* :setting:`DATA_UPLOAD_MAX_MEMORY_SIZE` limits the size that a request body |
| 769 |
may be. File uploads don't count toward this limit. |
| 770 |
* :setting:`DATA_UPLOAD_MAX_NUMBER_FIELDS` limits the number of GET/POST |
| 771 |
parameters that are parsed. |
| 772 |
|
| 773 |
Applications that receive unusually large form posts may need to tune these |
| 774 |
settings. |
| 775 |
|
| 776 |
Miscellaneous |
| 777 |
------------- |
| 778 |
|
| 779 |
* The ``repr()`` of a ``QuerySet`` is wrapped in ``<QuerySet >`` to |
| 780 |
disambiguate it from a plain list when debugging. |
| 781 |
|
| 782 |
* ``utils.version.get_version()`` returns :pep:`440` compliant release |
| 783 |
candidate versions (e.g. '1.10rc1' instead of '1.10c1'). |
| 784 |
|
| 785 |
* CSRF token values are now required to be strings of 64 alphanumerics; values |
| 786 |
of 32 alphanumerics, as set by older versions of Django by default, are |
| 787 |
automatically replaced by strings of 64 characters. Other values are |
| 788 |
considered invalid. This should only affect developers or users who replace |
| 789 |
these tokens. |
| 790 |
|
| 791 |
* The ``LOGOUT_URL`` setting is removed as Django hasn't made use of it |
| 792 |
since pre-1.0. If you use it in your project, you can add it to your |
| 793 |
project's settings. The default value was ``'/accounts/logout/'``. |
| 794 |
|
| 795 |
* Objects with a ``close()`` method such as files and generators passed to |
| 796 |
:class:`~django.http.HttpResponse` are now closed immediately instead of when |
| 797 |
the WSGI server calls ``close()`` on the response. |
| 798 |
|
| 799 |
* A redundant ``transaction.atomic()`` call in ``QuerySet.update_or_create()`` |
| 800 |
is removed. This may affect query counts tested by |
| 801 |
``TransactionTestCase.assertNumQueries()``. |
| 802 |
|
| 803 |
* Support for ``skip_validation`` in ``BaseCommand.execute(**options)`` is |
| 804 |
removed. Use ``skip_checks`` (added in Django 1.7) instead. |
| 805 |
|
| 806 |
* :djadmin:`loaddata` now raises a ``CommandError`` instead of showing a |
| 807 |
warning when the specified fixture file is not found. |
| 808 |
|
| 809 |
* Instead of directly accessing the ``LogEntry.change_message`` attribute, it's |
| 810 |
now better to call the ``LogEntry.get_change_message()`` method which will |
| 811 |
provide the message in the current language. |
| 812 |
|
| 813 |
* The default error views now raise ``TemplateDoesNotExist`` if a nonexistent |
| 814 |
``template_name`` is specified. |
| 815 |
|
| 816 |
* The unused ``choices`` keyword argument of the ``Select`` and |
| 817 |
``SelectMultiple`` widgets' ``render()`` method is removed. The ``choices`` |
| 818 |
argument of the ``render_options()`` method is also removed, making |
| 819 |
``selected_choices`` the first argument. |
| 820 |
|
| 821 |
* Tests that violate deferrable database constraints will now error when run on |
| 822 |
a database that supports deferrable constraints. |
| 823 |
|
| 824 |
* Built-in management commands now use indexing of keys in ``options``, e.g. |
| 825 |
``options['verbosity']``, instead of ``options.get()`` and no longer perform |
| 826 |
any type coercion. This could be a problem if you're calling commands using |
| 827 |
``Command.execute()`` (which bypasses the argument parser that sets a default |
| 828 |
value) instead of :func:`~django.core.management.call_command`. Instead of |
| 829 |
calling ``Command.execute()``, pass the command object as the first argument |
| 830 |
to ``call_command()``. |
| 831 |
|
| 832 |
* :class:`~django.contrib.auth.backends.ModelBackend` and |
| 833 |
:class:`~django.contrib.auth.backends.RemoteUserBackend` now reject inactive |
| 834 |
users. This means that inactive users can't login and will be logged |
| 835 |
out if they are switched from ``is_active=True`` to ``False``. If you need |
| 836 |
the previous behavior, use the new |
| 837 |
:class:`~django.contrib.auth.backends.AllowAllUsersModelBackend` or |
| 838 |
:class:`~django.contrib.auth.backends.AllowAllUsersRemoteUserBackend` |
| 839 |
in :setting:`AUTHENTICATION_BACKENDS` instead. |
| 840 |
|
| 841 |
* In light of the previous change, the test client's |
| 842 |
:meth:`~django.test.Client.login()` method no longer always rejects inactive |
| 843 |
users but instead delegates this decision to the authentication backend. |
| 844 |
:meth:`~django.test.Client.force_login()` also delegates the decision to the |
| 845 |
authentication backend, so if you're using the default backends, you need to |
| 846 |
use an active user. |
| 847 |
|
| 848 |
* :func:`django.views.i18n.set_language` may now return a 204 status code for |
| 849 |
AJAX requests. |
| 850 |
|
| 851 |
* The ``base_field`` attribute of |
| 852 |
:class:`~django.contrib.postgres.fields.RangeField` is now a type of field, |
| 853 |
not an instance of a field. If you have created a custom subclass of |
| 854 |
:class:`~django.contrib.postgres.fields.RangeField`, you should change the |
| 855 |
``base_field`` attribute. |
| 856 |
|
| 857 |
* Middleware classes are now initialized when the server starts rather than |
| 858 |
during the first request. |
| 859 |
|
| 860 |
* If you override ``is_authenticated()`` or ``is_anonymous()`` in a custom user |
| 861 |
model, you must convert them to attributes or properties as described in |
| 862 |
:ref:`the deprecation note <user-is-auth-anon-deprecation>`. |
| 863 |
|
| 864 |
* When using :attr:`ModelAdmin.save_as=True |
| 865 |
<django.contrib.admin.ModelAdmin.save_as>`, the "Save as new" button now |
| 866 |
redirects to the change view for the new object instead of to the model's |
| 867 |
changelist. If you need the previous behavior, set the new |
| 868 |
:attr:`ModelAdmin.save_as_continue |
| 869 |
<django.contrib.admin.ModelAdmin.save_as_continue>` attribute to ``False``. |
| 870 |
|
| 871 |
* Required form fields now have the ``required`` HTML attribute. Set the |
| 872 |
:attr:`Form.use_required_attribute <django.forms.Form.use_required_attribute>` |
| 873 |
attribute to ``False`` to disable it. You could also add the ``novalidate`` |
| 874 |
attribute to ``<form>`` if you don't want browser validation. To disable |
| 875 |
the ``required`` attribute on custom widgets, override the |
| 876 |
:meth:`Widget.use_required_attribute() <django.forms.Widget.use_required_attribute>` |
| 877 |
method. |
| 878 |
|
| 879 |
* The WSGI handler no longer removes content of responses from ``HEAD`` |
| 880 |
requests or responses with a ``status_code`` of 100-199, 204, or 304. Most |
| 881 |
web servers already implement this behavior. Responses retrieved using the |
| 882 |
Django test client continue to have these "response fixes" applied. |
| 883 |
|
| 884 |
* ``Model.__init__()`` now receives ``django.db.models.DEFERRED`` as the value |
| 885 |
of deferred fields. |
| 886 |
|
| 887 |
* The ``Model._deferred`` attribute is removed as dynamic model classes when |
| 888 |
using ``QuerySet.defer()`` and ``only()`` is removed. |
| 889 |
|
| 890 |
* :meth:`Storage.save() <django.core.files.storage.Storage.save>` no longer |
| 891 |
replaces ``'\'`` with ``'/'``. This behavior is moved to |
| 892 |
:class:`~django.core.files.storage.FileSystemStorage` since this is a storage |
| 893 |
specific implementation detail. Any Windows user with a custom storage |
| 894 |
implementation that relies on this behavior will need to implement it in the |
| 895 |
custom storage's ``save()`` method. |
| 896 |
|
| 897 |
* Private :class:`~django.db.models.FileField` methods ``get_directory_name()`` |
| 898 |
and ``get_filename()`` are no longer called (and are now deprecated) which is |
| 899 |
a backwards incompatible change for users overriding those methods on custom |
| 900 |
fields. To adapt such code, override ``FileField.generate_filename()`` or |
| 901 |
:meth:`Storage.generate_filename() |
| 902 |
<django.core.files.storage.Storage.generate_filename>` instead. It |
| 903 |
might be possible to use :attr:`~django.db.models.FileField.upload_to` also. |
| 904 |
|
| 905 |
* The subject of mail sent by ``AdminEmailHandler`` is no longer truncated at |
| 906 |
989 characters. If you were counting on a limited length, truncate the subject |
| 907 |
yourself. |
| 908 |
|
| 909 |
* Private expressions ``django.db.models.expressions.Date`` and ``DateTime`` |
| 910 |
are removed. The new :class:`~django.db.models.functions.Trunc` expressions |
| 911 |
provide the same functionality. |
| 912 |
|
| 913 |
* The ``_base_manager`` and ``_default_manager`` attributes are removed from |
| 914 |
model instances. They remain accessible on the model class. |
| 915 |
|
| 916 |
* Accessing a deleted field on a model instance, e.g. after ``del obj.field``, |
| 917 |
reloads the field's value instead of raising ``AttributeError``. |
| 918 |
|
| 919 |
* If you subclass ``AbstractBaseUser`` and override ``clean()``, be sure it |
| 920 |
calls ``super()``. :meth:`.AbstractBaseUser.normalize_username` is called in |
| 921 |
a new :meth:`.AbstractBaseUser.clean` method. |
| 922 |
|
| 923 |
* Private API ``django.forms.models.model_to_dict()`` returns a queryset rather |
| 924 |
than a list of primary keys for ``ManyToManyField``\s. |
| 925 |
|
| 926 |
* If ``django.contrib.staticfiles`` is |
| 927 |
installed, the :ttag:`static` template tag uses the ``staticfiles`` storage |
| 928 |
to construct the URL rather than simply joining the value with |
| 929 |
``STATIC_ROOT``. The new approach encodes the URL, which could be |
| 930 |
backwards-incompatible in cases such as including a fragment in a path, e.g. |
| 931 |
``{% static 'img.svg#fragment' %}``, since the ``#`` is encoded as ``%23``. |
| 932 |
To adapt, move the fragment outside the template tag: |
| 933 |
``{% static 'img.svg' %}#fragment``. |
| 934 |
|
| 935 |
* When ``USE_L10N`` is ``True``, localization is now applied for the |
| 936 |
:tfilter:`date` and :tfilter:`time` filters when no format string is |
| 937 |
specified. The ``DATE_FORMAT`` and ``TIME_FORMAT`` specifiers from the active |
| 938 |
locale are used instead of the settings of the same name. |
| 939 |
|
| 940 |
.. _deprecated-features-1.10: |
| 941 |
|
| 942 |
Features deprecated in 1.10 |
| 943 |
=========================== |
| 944 |
|
| 945 |
Direct assignment to a reverse foreign key or many-to-many relation |
| 946 |
------------------------------------------------------------------- |
| 947 |
|
| 948 |
Instead of assigning related objects using direct assignment: |
| 949 |
|
| 950 |
.. code-block:: pycon |
| 951 |
|
| 952 |
>>> new_list = [obj1, obj2, obj3] |
| 953 |
>>> e.related_set = new_list |
| 954 |
|
| 955 |
Use the :meth:`~django.db.models.fields.related.RelatedManager.set` method |
| 956 |
added in Django 1.9: |
| 957 |
|
| 958 |
.. code-block:: pycon |
| 959 |
|
| 960 |
>>> e.related_set.set([obj1, obj2, obj3]) |
| 961 |
|
| 962 |
This prevents confusion about an assignment resulting in an implicit save. |
| 963 |
|
| 964 |
Non-timezone-aware :class:`~django.core.files.storage.Storage` API |
| 965 |
------------------------------------------------------------------ |
| 966 |
|
| 967 |
The old, non-timezone-aware methods ``accessed_time()``, ``created_time()``, |
| 968 |
and ``modified_time()`` are deprecated in favor of the new ``get_*_time()`` |
| 969 |
methods. |
| 970 |
|
| 971 |
Third-party storage backends should implement the new methods and mark the old |
| 972 |
ones as deprecated. Until then, the new ``get_*_time()`` methods on the base |
| 973 |
:class:`~django.core.files.storage.Storage` class convert ``datetime``\s from |
| 974 |
the old methods as required and emit a deprecation warning as they do so. |
| 975 |
|
| 976 |
Third-party storage backends may retain the old methods as long as they |
| 977 |
wish to support earlier versions of Django. |
| 978 |
|
| 979 |
:mod:`django.contrib.gis` |
| 980 |
------------------------- |
| 981 |
|
| 982 |
* The ``get_srid()`` and ``set_srid()`` methods of |
| 983 |
:class:`~django.contrib.gis.geos.GEOSGeometry` are deprecated in favor |
| 984 |
of the :attr:`~django.contrib.gis.geos.GEOSGeometry.srid` property. |
| 985 |
|
| 986 |
* The ``get_x()``, ``set_x()``, ``get_y()``, ``set_y()``, ``get_z()``, and |
| 987 |
``set_z()`` methods of :class:`~django.contrib.gis.geos.Point` are deprecated |
| 988 |
in favor of the ``x``, ``y``, and ``z`` properties. |
| 989 |
|
| 990 |
* The ``get_coords()`` and ``set_coords()`` methods of |
| 991 |
:class:`~django.contrib.gis.geos.Point` are deprecated in favor of the |
| 992 |
``tuple`` property. |
| 993 |
|
| 994 |
* The ``cascaded_union`` property of |
| 995 |
:class:`~django.contrib.gis.geos.MultiPolygon` is deprecated in favor of the |
| 996 |
:attr:`~django.contrib.gis.geos.GEOSGeometry.unary_union` property. |
| 997 |
|
| 998 |
* The ``django.contrib.gis.utils.precision_wkt()`` function is deprecated in |
| 999 |
favor of :class:`~django.contrib.gis.geos.WKTWriter`. |
| 1000 |
|
| 1001 |
``CommaSeparatedIntegerField`` model field |
| 1002 |
------------------------------------------ |
| 1003 |
|
| 1004 |
``CommaSeparatedIntegerField`` is deprecated in favor of |
| 1005 |
:class:`~django.db.models.CharField` with the |
| 1006 |
:func:`~django.core.validators.validate_comma_separated_integer_list` |
| 1007 |
validator:: |
| 1008 |
|
| 1009 |
from django.core.validators import validate_comma_separated_integer_list |
| 1010 |
from django.db import models |
| 1011 |
|
| 1012 |
|
| 1013 |
class MyModel(models.Model): |
| 1014 |
numbers = models.CharField(..., validators=[validate_comma_separated_integer_list]) |
| 1015 |
|
| 1016 |
If you're using Oracle, ``CharField`` uses a different database field type |
| 1017 |
(``NVARCHAR2``) than ``CommaSeparatedIntegerField`` (``VARCHAR2``). Depending |
| 1018 |
on your database settings, this might imply a different encoding, and thus a |
| 1019 |
different length (in bytes) for the same contents. If your stored values are |
| 1020 |
longer than the 4000 byte limit of ``NVARCHAR2``, you should use ``TextField`` |
| 1021 |
(``NCLOB``) instead. In this case, if you have any queries that group by the |
| 1022 |
field (e.g. annotating the model with an aggregation or using ``distinct()``) |
| 1023 |
you'll need to change them (to defer the field). |
| 1024 |
|
| 1025 |
Using a model name as a query lookup when ``default_related_name`` is set |
| 1026 |
------------------------------------------------------------------------- |
| 1027 |
|
| 1028 |
Assume the following models:: |
| 1029 |
|
| 1030 |
from django.db import models |
| 1031 |
|
| 1032 |
|
| 1033 |
class Foo(models.Model): |
| 1034 |
pass |
| 1035 |
|
| 1036 |
|
| 1037 |
class Bar(models.Model): |
| 1038 |
foo = models.ForeignKey(Foo) |
| 1039 |
|
| 1040 |
class Meta: |
| 1041 |
default_related_name = "bars" |
| 1042 |
|
| 1043 |
In older versions, :attr:`~django.db.models.Options.default_related_name` |
| 1044 |
couldn't be used as a query lookup. This is fixed and support for the old |
| 1045 |
lookup name is deprecated. For example, since ``default_related_name`` is set |
| 1046 |
in model ``Bar``, instead of using the model name ``bar`` as the lookup: |
| 1047 |
|
| 1048 |
.. code-block:: pycon |
| 1049 |
|
| 1050 |
>>> bar = Bar.objects.get(pk=1) |
| 1051 |
>>> Foo.objects.get(bar=bar) |
| 1052 |
|
| 1053 |
use the default_related_name ``bars``: |
| 1054 |
|
| 1055 |
.. code-block:: pycon |
| 1056 |
|
| 1057 |
>>> Foo.objects.get(bars=bar) |
| 1058 |
|
| 1059 |
.. _search-lookup-replacement: |
| 1060 |
|
| 1061 |
``__search`` query lookup |
| 1062 |
------------------------- |
| 1063 |
|
| 1064 |
The ``search`` lookup, which supports MySQL only and is extremely limited in |
| 1065 |
features, is deprecated. Replace it with a custom lookup:: |
| 1066 |
|
| 1067 |
from django.db import models |
| 1068 |
|
| 1069 |
|
| 1070 |
class Search(models.Lookup): |
| 1071 |
lookup_name = "search" |
| 1072 |
|
| 1073 |
def as_mysql(self, compiler, connection): |
| 1074 |
lhs, lhs_params = self.process_lhs(compiler, connection) |
| 1075 |
rhs, rhs_params = self.process_rhs(compiler, connection) |
| 1076 |
params = lhs_params + rhs_params |
| 1077 |
return "MATCH (%s) AGAINST (%s IN BOOLEAN MODE)" % (lhs, rhs), params |
| 1078 |
|
| 1079 |
|
| 1080 |
models.CharField.register_lookup(Search) |
| 1081 |
models.TextField.register_lookup(Search) |
| 1082 |
|
| 1083 |
.. _user-is-auth-anon-deprecation: |
| 1084 |
|
| 1085 |
Using ``User.is_authenticated()`` and ``User.is_anonymous()`` as methods |
| 1086 |
------------------------------------------------------------------------ |
| 1087 |
|
| 1088 |
The ``is_authenticated()`` and ``is_anonymous()`` methods of |
| 1089 |
:class:`~django.contrib.auth.models.AbstractBaseUser` and |
| 1090 |
:class:`~django.contrib.auth.models.AnonymousUser` classes are now |
| 1091 |
properties. They will still work as methods until Django 2.0, but all usage |
| 1092 |
in Django now uses attribute access. |
| 1093 |
|
| 1094 |
For example, if you use |
| 1095 |
:class:`~django.contrib.auth.middleware.AuthenticationMiddleware` and want |
| 1096 |
to know whether the user is currently logged-in you would use:: |
| 1097 |
|
| 1098 |
if request.user.is_authenticated: |
| 1099 |
... # Do something for logged-in users. |
| 1100 |
else: |
| 1101 |
... # Do something for anonymous users. |
| 1102 |
|
| 1103 |
instead of ``request.user.is_authenticated()``. |
| 1104 |
|
| 1105 |
This change avoids accidental information leakage if you forget to call the |
| 1106 |
method, e.g.:: |
| 1107 |
|
| 1108 |
if request.user.is_authenticated: |
| 1109 |
return sensitive_information |
| 1110 |
|
| 1111 |
If you override these methods in a custom user model, you must change them to |
| 1112 |
properties or attributes. |
| 1113 |
|
| 1114 |
Django uses a ``CallableBool`` object to allow these attributes to work as both |
| 1115 |
a property and a method. Thus, until the deprecation period ends, you cannot |
| 1116 |
compare these properties using the ``is`` operator. That is, the following |
| 1117 |
won't work:: |
| 1118 |
|
| 1119 |
if request.user.is_authenticated is True: |
| 1120 |
... |
| 1121 |
|
| 1122 |
Custom manager classes available through ``prefetch_related`` must define a ``_apply_rel_filters()`` method |
| 1123 |
----------------------------------------------------------------------------------------------------------- |
| 1124 |
|
| 1125 |
If you defined a custom manager class available through |
| 1126 |
:meth:`~django.db.models.query.QuerySet.prefetch_related` you must make sure |
| 1127 |
it defines a ``_apply_rel_filters()`` method. |
| 1128 |
|
| 1129 |
This method must accept a :class:`~django.db.models.query.QuerySet` instance |
| 1130 |
as its single argument and return a filtered version of the queryset for the |
| 1131 |
model instance the manager is bound to. |
| 1132 |
|
| 1133 |
The "escape" half of ``django.utils.safestring`` |
| 1134 |
------------------------------------------------ |
| 1135 |
|
| 1136 |
The ``mark_for_escaping()`` function and the classes it uses: ``EscapeData``, |
| 1137 |
``EscapeBytes``, ``EscapeText``, ``EscapeString``, and ``EscapeUnicode`` are |
| 1138 |
deprecated. |
| 1139 |
|
| 1140 |
As a result, the "lazy" behavior of the ``escape`` filter (where it would |
| 1141 |
always be applied as the last filter no matter where in the filter chain it |
| 1142 |
appeared) is deprecated. The filter will change to immediately apply |
| 1143 |
:func:`~django.utils.html.conditional_escape` in Django 2.0. |
| 1144 |
|
| 1145 |
``Manager.use_for_related_fields`` and inheritance changes |
| 1146 |
---------------------------------------------------------- |
| 1147 |
|
| 1148 |
``Manager.use_for_related_fields`` is deprecated in favor of setting |
| 1149 |
:attr:`Meta.base_manager_name <django.db.models.Options.base_manager_name>` on |
| 1150 |
the model. |
| 1151 |
|
| 1152 |
Model ``Manager`` inheritance will follow MRO inheritance rules in Django 2.0, |
| 1153 |
changing the current behavior where managers defined on non-abstract base |
| 1154 |
classes aren't inherited by child classes. A deprecating warning with |
| 1155 |
instructions on how to adapt your code is raised if you have any affected |
| 1156 |
managers. You'll either redeclare a manager from an abstract model on the child |
| 1157 |
class to override the manager from the concrete model, or you'll set the |
| 1158 |
model's ``Meta.manager_inheritance_from_future=True`` option to opt-in to the |
| 1159 |
new inheritance behavior. |
| 1160 |
|
| 1161 |
During the deprecation period, ``use_for_related_fields`` will be honored and |
| 1162 |
raise a warning, even if a ``base_manager_name`` is set. This allows |
| 1163 |
third-party code to preserve legacy behavior while transitioning to the new |
| 1164 |
API. The warning can be silenced by setting |
| 1165 |
``silence_use_for_related_fields_deprecation=True`` on the manager. |
| 1166 |
|
| 1167 |
Miscellaneous |
| 1168 |
------------- |
| 1169 |
|
| 1170 |
* The ``makemigrations --exit`` option is deprecated in favor of the |
| 1171 |
:option:`makemigrations --check` option. |
| 1172 |
|
| 1173 |
* ``django.utils.functional.allow_lazy()`` is deprecated in favor of the new |
| 1174 |
:func:`~django.utils.functional.keep_lazy` function which can be used with a |
| 1175 |
more natural decorator syntax. |
| 1176 |
|
| 1177 |
* The ``shell --plain`` option is deprecated in favor of ``-i python`` or |
| 1178 |
``--interface python``. |
| 1179 |
|
| 1180 |
* Importing from the ``django.core.urlresolvers`` module is deprecated in |
| 1181 |
favor of its new location, :mod:`django.urls`. |
| 1182 |
|
| 1183 |
* The template ``Context.has_key()`` method is deprecated in favor of ``in``. |
| 1184 |
|
| 1185 |
* The private attribute ``virtual_fields`` of ``Model._meta`` is |
| 1186 |
deprecated in favor of ``private_fields``. |
| 1187 |
|
| 1188 |
* The private keyword arguments ``virtual_only`` in |
| 1189 |
``Field.contribute_to_class()`` and ``virtual`` in |
| 1190 |
``Model._meta.add_field()`` are deprecated in favor of ``private_only`` |
| 1191 |
and ``private``, respectively. |
| 1192 |
|
| 1193 |
* The ``javascript_catalog()`` and ``json_catalog()`` views are deprecated in |
| 1194 |
favor of class-based views :class:`~django.views.i18n.JavaScriptCatalog` |
| 1195 |
and :class:`~django.views.i18n.JSONCatalog`. |
| 1196 |
|
| 1197 |
* In multi-table inheritance, implicit promotion of a ``OneToOneField`` to a |
| 1198 |
``parent_link`` is deprecated. Add ``parent_link=True`` to such fields. |
| 1199 |
|
| 1200 |
* The private API ``Widget._format_value()`` is made public and renamed to |
| 1201 |
:meth:`~django.forms.Widget.format_value`. The old name will work |
| 1202 |
through a deprecation period. |
| 1203 |
|
| 1204 |
* Private ``FileField`` methods ``get_directory_name()`` and ``get_filename()`` |
| 1205 |
are deprecated in favor of performing this work in |
| 1206 |
:meth:`Storage.generate_filename() |
| 1207 |
<django.core.files.storage.Storage.generate_filename>`). |
| 1208 |
|
| 1209 |
* Old-style middleware that uses ``settings.MIDDLEWARE_CLASSES`` are |
| 1210 |
deprecated. :ref:`Adapt old, custom middleware <upgrading-middleware>` and |
| 1211 |
use the new :setting:`MIDDLEWARE` setting. |
| 1212 |
|
| 1213 |
.. _removed-features-1.10: |
| 1214 |
|
| 1215 |
Features removed in 1.10 |
| 1216 |
======================== |
| 1217 |
|
| 1218 |
These features have reached the end of their deprecation cycle and are removed |
| 1219 |
in Django 1.10. See :ref:`deprecated-features-1.8` for details, including how |
| 1220 |
to remove usage of these features. |
| 1221 |
|
| 1222 |
* Support for calling a ``SQLCompiler`` directly as an alias for calling its |
| 1223 |
``quote_name_unless_alias`` method is removed. |
| 1224 |
|
| 1225 |
* The ``cycle`` and ``firstof`` template tags are removed from the ``future`` |
| 1226 |
template tag library. |
| 1227 |
|
| 1228 |
* ``django.conf.urls.patterns()`` is removed. |
| 1229 |
|
| 1230 |
* Support for the ``prefix`` argument to |
| 1231 |
``django.conf.urls.i18n.i18n_patterns()`` is removed. |
| 1232 |
|
| 1233 |
* ``SimpleTestCase.urls`` is removed. |
| 1234 |
|
| 1235 |
* Using an incorrect count of unpacked values in the ``for`` template tag |
| 1236 |
raises an exception rather than failing silently. |
| 1237 |
|
| 1238 |
* The ability to :func:`~django.urls.reverse` URLs using a dotted Python path |
| 1239 |
is removed. |
| 1240 |
|
| 1241 |
* The ability to use a dotted Python path for the ``LOGIN_URL`` and |
| 1242 |
``LOGIN_REDIRECT_URL`` settings is removed. |
| 1243 |
|
| 1244 |
* Support for ``optparse`` is dropped for custom management commands. |
| 1245 |
|
| 1246 |
* The class ``django.core.management.NoArgsCommand`` is removed. |
| 1247 |
|
| 1248 |
* ``django.core.context_processors`` module is removed. |
| 1249 |
|
| 1250 |
* ``django.db.models.sql.aggregates`` module is removed. |
| 1251 |
|
| 1252 |
* ``django.contrib.gis.db.models.sql.aggregates`` module is removed. |
| 1253 |
|
| 1254 |
* The following methods and properties of ``django.db.sql.query.Query`` are |
| 1255 |
removed: |
| 1256 |
|
| 1257 |
* Properties: ``aggregates`` and ``aggregate_select`` |
| 1258 |
* Methods: ``add_aggregate``, ``set_aggregate_mask``, and |
| 1259 |
``append_aggregate_mask``. |
| 1260 |
|
| 1261 |
* ``django.template.resolve_variable`` is removed. |
| 1262 |
|
| 1263 |
* The following private APIs are removed from |
| 1264 |
:class:`django.db.models.options.Options` (``Model._meta``): |
| 1265 |
|
| 1266 |
* ``get_field_by_name()`` |
| 1267 |
* ``get_all_field_names()`` |
| 1268 |
* ``get_fields_with_model()`` |
| 1269 |
* ``get_concrete_fields_with_model()`` |
| 1270 |
* ``get_m2m_with_model()`` |
| 1271 |
* ``get_all_related_objects()`` |
| 1272 |
* ``get_all_related_objects_with_model()`` |
| 1273 |
* ``get_all_related_many_to_many_objects()`` |
| 1274 |
* ``get_all_related_m2m_objects_with_model()`` |
| 1275 |
|
| 1276 |
* The ``error_message`` argument of ``django.forms.RegexField`` is removed. |
| 1277 |
|
| 1278 |
* The ``unordered_list`` filter no longer supports old style lists. |
| 1279 |
|
| 1280 |
* Support for string ``view`` arguments to ``url()`` is removed. |
| 1281 |
|
| 1282 |
* The backward compatible shim to rename ``django.forms.Form._has_changed()`` |
| 1283 |
to ``has_changed()`` is removed. |
| 1284 |
|
| 1285 |
* The ``removetags`` template filter is removed. |
| 1286 |
|
| 1287 |
* The ``remove_tags()`` and ``strip_entities()`` functions in |
| 1288 |
``django.utils.html`` is removed. |
| 1289 |
|
| 1290 |
* The ``is_admin_site`` argument to |
| 1291 |
``django.contrib.auth.views.password_reset()`` is removed. |
| 1292 |
|
| 1293 |
* ``django.db.models.field.subclassing.SubfieldBase`` is removed. |
| 1294 |
|
| 1295 |
* ``django.utils.checksums`` is removed. |
| 1296 |
|
| 1297 |
* The ``original_content_type_id`` attribute on |
| 1298 |
``django.contrib.admin.helpers.InlineAdminForm`` is removed. |
| 1299 |
|
| 1300 |
* The backwards compatibility shim to allow ``FormMixin.get_form()`` to be |
| 1301 |
defined with no default value for its ``form_class`` argument is removed. |
| 1302 |
|
| 1303 |
* The following settings are removed, and you must upgrade to the |
| 1304 |
:setting:`TEMPLATES` setting: |
| 1305 |
|
| 1306 |
* ``ALLOWED_INCLUDE_ROOTS`` |
| 1307 |
* ``TEMPLATE_CONTEXT_PROCESSORS`` |
| 1308 |
* ``TEMPLATE_DEBUG`` |
| 1309 |
* ``TEMPLATE_DIRS`` |
| 1310 |
* ``TEMPLATE_LOADERS`` |
| 1311 |
* ``TEMPLATE_STRING_IF_INVALID`` |
| 1312 |
|
| 1313 |
* The backwards compatibility alias ``django.template.loader.BaseLoader`` is |
| 1314 |
removed. |
| 1315 |
|
| 1316 |
* Django template objects returned by |
| 1317 |
:func:`~django.template.loader.get_template` and |
| 1318 |
:func:`~django.template.loader.select_template` no longer accept a |
| 1319 |
:class:`~django.template.Context` in their |
| 1320 |
:meth:`~django.template.backends.base.Template.render()` method. |
| 1321 |
|
| 1322 |
* :doc:`Template response APIs </ref/template-response>` enforce the use of |
| 1323 |
:class:`dict` and backend-dependent template objects instead of |
| 1324 |
:class:`~django.template.Context` and :class:`~django.template.Template` |
| 1325 |
respectively. |
| 1326 |
|
| 1327 |
* The ``current_app`` parameter for the following function and classes is |
| 1328 |
removed: |
| 1329 |
|
| 1330 |
* ``django.shortcuts.render()`` |
| 1331 |
* ``django.template.Context()`` |
| 1332 |
* ``django.template.RequestContext()`` |
| 1333 |
* ``django.template.response.TemplateResponse()`` |
| 1334 |
|
| 1335 |
* The ``dictionary`` and ``context_instance`` parameters for the following |
| 1336 |
functions are removed: |
| 1337 |
|
| 1338 |
* ``django.shortcuts.render()`` |
| 1339 |
* ``django.shortcuts.render_to_response()`` |
| 1340 |
* ``django.template.loader.render_to_string()`` |
| 1341 |
|
| 1342 |
* The ``dirs`` parameter for the following functions is removed: |
| 1343 |
|
| 1344 |
* ``django.template.loader.get_template()`` |
| 1345 |
* ``django.template.loader.select_template()`` |
| 1346 |
* ``django.shortcuts.render()`` |
| 1347 |
* ``django.shortcuts.render_to_response()`` |
| 1348 |
|
| 1349 |
* Session verification is enabled regardless of whether or not |
| 1350 |
``'django.contrib.auth.middleware.SessionAuthenticationMiddleware'`` is in |
| 1351 |
``MIDDLEWARE_CLASSES``. ``SessionAuthenticationMiddleware`` no longer has |
| 1352 |
any purpose and can be removed from ``MIDDLEWARE_CLASSES``. It's kept as |
| 1353 |
a stub until Django 2.0 as a courtesy for users who don't read this note. |
| 1354 |
|
| 1355 |
* Private attribute ``django.db.models.Field.related`` is removed. |
| 1356 |
|
| 1357 |
* The ``--list`` option of the ``migrate`` management command is removed. |
| 1358 |
|
| 1359 |
* The ``ssi`` template tag is removed. |
| 1360 |
|
| 1361 |
* Support for the ``=`` comparison operator in the ``if`` template tag is |
| 1362 |
removed. |
| 1363 |
|
| 1364 |
* The backwards compatibility shims to allow ``Storage.get_available_name()`` |
| 1365 |
and ``Storage.save()`` to be defined without a ``max_length`` argument are |
| 1366 |
removed. |
| 1367 |
|
| 1368 |
* Support for the legacy ``%(<foo>)s`` syntax in ``ModelFormMixin.success_url`` |
| 1369 |
is removed. |
| 1370 |
|
| 1371 |
* ``GeoQuerySet`` aggregate methods ``collect()``, ``extent()``, ``extent3d()``, |
| 1372 |
``make_line()``, and ``unionagg()`` are removed. |
| 1373 |
|
| 1374 |
* The ability to specify ``ContentType.name`` when creating a content type |
| 1375 |
instance is removed. |
| 1376 |
|
| 1377 |
* Support for the old signature of ``allow_migrate`` is removed. |
| 1378 |
|
| 1379 |
* Support for the syntax of ``{% cycle %}`` that uses comma-separated arguments |
| 1380 |
is removed. |
| 1381 |
|
| 1382 |
* The warning that :class:`~django.core.signing.Signer` issued when given an |
| 1383 |
invalid separator is now a ``ValueError``. |