{"title":"Django 1.10 release notes","version":"dev","locale":"en","docname":"releases/1.10","url":"/en/dev/releases/1.10/","canonical":"https://djangodocs.dev/en/dev/releases/1.10/","summary":"Welcome to Django 1.10! These release notes cover the new features, as well as some backwards incompatible changes you’ll want to be aware of when upgrading…","html":"<h1>Django 1.10 release notes<a class=\"heading-anchor\" href=\"#django-1-10-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>August 1, 2016</em></p>\n<p>Welcome to Django 1.10!</p>\n<p>These release notes cover the <a class=\"reference internal\" href=\"#whats-new-1-10\"><span class=\"std std-ref\">new features</span></a>, as well as\nsome <a class=\"reference internal\" href=\"#backwards-incompatible-1-10\"><span class=\"std std-ref\">backwards incompatible changes</span></a> you’ll\nwant to be aware of when upgrading from Django 1.9 or older versions. We’ve\n<a class=\"reference internal\" href=\"#removed-features-1-10\"><span class=\"std std-ref\">dropped some features</span></a> that have reached the end\nof their deprecation cycle, and we’ve <a class=\"reference internal\" href=\"#deprecated-features-1-10\"><span class=\"std std-ref\">begun the deprecation process for\nsome features</span></a>.</p>\n<p>See the <a class=\"reference internal\" href=\"/en/dev/howto/upgrade-version/\"><span class=\"doc\">How to upgrade Django to a newer version</span></a> guide if you’re updating an existing\nproject.</p>\n<section id=\"python-compatibility\">\n<h2>Python compatibility<a class=\"heading-anchor\" href=\"#python-compatibility\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Like Django 1.9, Django 1.10 requires Python 2.7, 3.4, or 3.5. We <strong>highly\nrecommend</strong> and only officially support the latest release of each series.</p>\n</section>\n<section id=\"what-s-new-in-django-1-10\">\n<span id=\"whats-new-1-10\"></span><h2>What’s new in Django 1.10<a class=\"heading-anchor\" href=\"#what-s-new-in-django-1-10\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"full-text-search-for-postgresql\">\n<h3>Full text search for PostgreSQL<a class=\"heading-anchor\" href=\"#full-text-search-for-postgresql\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">django.contrib.postgres</code> now includes a <a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/search/\"><span class=\"doc\">collection of database\nfunctions</span></a> to allow the use of the full text\nsearch engine. You can search across multiple fields in your relational\ndatabase, combine the searches with other lookups, use different language\nconfigurations and weightings, and rank the results by relevance.</p>\n<p>It also now includes trigram support, using the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/lookups/#std-fieldlookup-trigram_similar\"><code class=\"xref std std-lookup docutils literal notranslate\">trigram_similar</code></a>\nlookup, and the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/search/#django.contrib.postgres.search.TrigramSimilarity\" title=\"django.contrib.postgres.search.TrigramSimilarity\"><code class=\"xref py py-class docutils literal notranslate\">TrigramSimilarity</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/search/#django.contrib.postgres.search.TrigramDistance\" title=\"django.contrib.postgres.search.TrigramDistance\"><code class=\"xref py py-class docutils literal notranslate\">TrigramDistance</code></a> expressions.</p>\n</section>\n<section id=\"new-style-middleware\">\n<h3>New-style middleware<a class=\"heading-anchor\" href=\"#new-style-middleware\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"/en/dev/topics/http/middleware/\"><span class=\"doc\">A new style of middleware is introduced</span></a> to\nsolve the lack of strict request/response layering of the old-style of\nmiddleware described in <a class=\"reference external\" href=\"https://github.com/django/deps/blob/main/final/0005-improved-middleware.rst\">DEP 0005</a>.\nYou’ll need to <a class=\"reference internal\" href=\"/en/dev/topics/http/middleware/#upgrading-middleware\"><span class=\"std std-ref\">adapt old, custom middleware</span></a> and\nswitch from the <code class=\"docutils literal notranslate\">MIDDLEWARE_CLASSES</code> setting to the new <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-MIDDLEWARE\"><code class=\"xref std std-setting docutils literal notranslate\">MIDDLEWARE</code></a>\nsetting to take advantage of the improvements.</p>\n</section>\n<section id=\"official-support-for-unicode-usernames\">\n<h3>Official support for Unicode usernames<a class=\"heading-anchor\" href=\"#official-support-for-unicode-usernames\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.User\" title=\"django.contrib.auth.models.User\"><code class=\"xref py py-class docutils literal notranslate\">User</code></a> model in <code class=\"docutils literal notranslate\">django.contrib.auth</code>\noriginally only accepted ASCII letters and numbers in usernames. Although it\nwasn’t a deliberate choice, Unicode characters have always been accepted when\nusing Python 3.</p>\n<p>The username validator now explicitly accepts Unicode characters by\ndefault on Python 3 only.</p>\n<p>Custom user models may use the new\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.validators.ASCIIUsernameValidator\" title=\"django.contrib.auth.validators.ASCIIUsernameValidator\"><code class=\"xref py py-class docutils literal notranslate\">ASCIIUsernameValidator</code></a> or\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.validators.UnicodeUsernameValidator\" title=\"django.contrib.auth.validators.UnicodeUsernameValidator\"><code class=\"xref py py-class docutils literal notranslate\">UnicodeUsernameValidator</code></a>.</p>\n</section>\n<section id=\"minor-features\">\n<h3>Minor features<a class=\"heading-anchor\" href=\"#minor-features\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"django-contrib-admin\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#module-django.contrib.admin\" title=\"django.contrib.admin: Django's admin site.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.admin</code></a><a class=\"heading-anchor\" href=\"#django-contrib-admin\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>For sites running on a subpath, the default <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.AdminSite.site_url\" title=\"django.contrib.admin.AdminSite.site_url\"><code class=\"xref py py-attr docutils literal notranslate\">URL for the &quot;View site&quot;\nlink</code></a> at the top of each admin page\nwill now point to <code class=\"docutils literal notranslate\">request.META['SCRIPT_NAME']</code> if set, instead of <code class=\"docutils literal notranslate\">/</code>.</p></li>\n<li><p>The success message that appears after adding or editing an object now\ncontains a link to the object’s change form.</p></li>\n<li><p>All inline JavaScript is removed so you can enable the\n<code class=\"docutils literal notranslate\">Content-Security-Policy</code> HTTP header if you wish.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.classes\" title=\"django.contrib.admin.InlineModelAdmin.classes\"><code class=\"xref py py-attr docutils literal notranslate\">InlineModelAdmin.classes</code></a> attribute allows specifying\nclasses on inline fieldsets. Inlines with a <code class=\"docutils literal notranslate\">collapse</code> class will be\ninitially collapsed and their header will have a small “show” link.</p></li>\n<li><p>If a user doesn’t have the add permission, the <code class=\"docutils literal notranslate\">object-tools</code> block on a\nmodel’s changelist will now be rendered (without the add button). This makes\nit easier to add custom tools in this case.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.models.LogEntry\" title=\"django.contrib.admin.models.LogEntry\"><code class=\"xref py py-class docutils literal notranslate\">LogEntry</code></a> model now stores change\nmessages in a JSON structure so that the message can be dynamically\ntranslated using the current active language. A new\n<code class=\"docutils literal notranslate\">LogEntry.get_change_message()</code> method is now the preferred way of\nretrieving the change message.</p></li>\n<li><p>Selected objects for fields in <code class=\"docutils literal notranslate\">ModelAdmin.raw_id_fields</code> now have a link\nto object’s change form.</p></li>\n<li><p>Added “No date” and “Has date” choices for <code class=\"docutils literal notranslate\">DateFieldListFilter</code> if the\nfield is nullable.</p></li>\n<li><p>The jQuery library embedded in the admin is upgraded from version 2.1.4 to\n2.2.3.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-auth\">\n<h4><a class=\"reference internal\" href=\"/en/dev/topics/auth/#module-django.contrib.auth\" title=\"django.contrib.auth: Django's authentication framework.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.auth</code></a><a class=\"heading-anchor\" href=\"#django-contrib-auth\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Added support for the <a class=\"reference internal\" href=\"/en/dev/topics/auth/passwords/#argon2-usage\"><span class=\"std std-ref\">Argon2 password hash</span></a>. It’s\nrecommended over PBKDF2, however, it’s not the default as it requires a\nthird-party library.</p></li>\n<li><p>The default iteration count for the PBKDF2 password hasher has been increased\nby 25%. This backwards compatible change will not affect users who have\nsubclassed <code class=\"docutils literal notranslate\">django.contrib.auth.hashers.PBKDF2PasswordHasher</code> to change the\ndefault value.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">django.contrib.auth.views.logout()</code> view sends “no-cache” headers\nto prevent an issue where Safari caches redirects and prevents a user from\nbeing able to log out.</p></li>\n<li><p>Added the optional <code class=\"docutils literal notranslate\">backend</code> argument to <a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.login\" title=\"django.contrib.auth.login\"><code class=\"xref py py-func docutils literal notranslate\">django.contrib.auth.login()</code></a>\nto allow using it without credentials.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOGOUT_REDIRECT_URL\"><code class=\"xref std std-setting docutils literal notranslate\">LOGOUT_REDIRECT_URL</code></a> setting controls the redirect of the\n<code class=\"docutils literal notranslate\">django.contrib.auth.views.logout()</code> view, if the view doesn’t get a\n<code class=\"docutils literal notranslate\">next_page</code> argument.</p></li>\n<li><p>The new <code class=\"docutils literal notranslate\">redirect_authenticated_user</code> parameter for the\n<code class=\"docutils literal notranslate\">django.contrib.auth.views.login()</code> view allows redirecting\nauthenticated users visiting the login page.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.backends.AllowAllUsersModelBackend\" title=\"django.contrib.auth.backends.AllowAllUsersModelBackend\"><code class=\"xref py py-class docutils literal notranslate\">AllowAllUsersModelBackend</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.backends.AllowAllUsersRemoteUserBackend\" title=\"django.contrib.auth.backends.AllowAllUsersRemoteUserBackend\"><code class=\"xref py py-class docutils literal notranslate\">AllowAllUsersRemoteUserBackend</code></a> ignore\nthe value of <code class=\"docutils literal notranslate\">User.is_active</code>, while\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.backends.ModelBackend\" title=\"django.contrib.auth.backends.ModelBackend\"><code class=\"xref py py-class docutils literal notranslate\">ModelBackend</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.backends.RemoteUserBackend\" title=\"django.contrib.auth.backends.RemoteUserBackend\"><code class=\"xref py py-class docutils literal notranslate\">RemoteUserBackend</code></a> now reject inactive\nusers.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-gis\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/#module-django.contrib.gis\" title=\"django.contrib.gis: Geographic Information System (GIS) extensions for Django\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.gis</code></a><a class=\"heading-anchor\" href=\"#django-contrib-gis\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geoquerysets/#distance-lookups\"><span class=\"std std-ref\">Distance lookups</span></a> now accept expressions as the\ndistance value parameter.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.unary_union\" title=\"django.contrib.gis.geos.GEOSGeometry.unary_union\"><code class=\"xref py py-attr docutils literal notranslate\">GEOSGeometry.unary_union</code></a> property computes the\nunion of all the elements of this geometry.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.covers\" title=\"django.contrib.gis.geos.GEOSGeometry.covers\"><code class=\"xref py py-meth docutils literal notranslate\">GEOSGeometry.covers()</code></a> binary predicate.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALBand.statistics\" title=\"django.contrib.gis.gdal.GDALBand.statistics\"><code class=\"xref py py-meth docutils literal notranslate\">GDALBand.statistics()</code></a> method and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALBand.mean\" title=\"django.contrib.gis.gdal.GDALBand.mean\"><code class=\"xref py py-attr docutils literal notranslate\">mean</code></a>\nand <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALBand.std\" title=\"django.contrib.gis.gdal.GDALBand.std\"><code class=\"xref py py-attr docutils literal notranslate\">std</code></a> attributes.</p></li>\n<li><p>Added support for the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geoquerysets/#django.contrib.gis.db.models.MakeLine\" title=\"django.contrib.gis.db.models.MakeLine\"><code class=\"xref py py-class docutils literal notranslate\">MakeLine</code></a>\naggregate and <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.GeoHash\" title=\"django.contrib.gis.db.models.functions.GeoHash\"><code class=\"xref py py-class docutils literal notranslate\">GeoHash</code></a>\nfunction on SpatiaLite.</p></li>\n<li><p>Added support for the\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Difference\" title=\"django.contrib.gis.db.models.functions.Difference\"><code class=\"xref py py-class docutils literal notranslate\">Difference</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Intersection\" title=\"django.contrib.gis.db.models.functions.Intersection\"><code class=\"xref py py-class docutils literal notranslate\">Intersection</code></a>, and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.SymDifference\" title=\"django.contrib.gis.db.models.functions.SymDifference\"><code class=\"xref py py-class docutils literal notranslate\">SymDifference</code></a>\nfunctions on MySQL.</p></li>\n<li><p>Added support for instantiating empty GEOS geometries.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.WKTWriter.trim\" title=\"django.contrib.gis.geos.WKTWriter.trim\"><code class=\"xref py py-attr docutils literal notranslate\">trim</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.WKTWriter.precision\" title=\"django.contrib.gis.geos.WKTWriter.precision\"><code class=\"xref py py-attr docutils literal notranslate\">precision</code></a> properties\nof <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.WKTWriter\" title=\"django.contrib.gis.geos.WKTWriter\"><code class=\"xref py py-class docutils literal notranslate\">WKTWriter</code></a> allow controlling\noutput of the fractional part of the coordinates in WKT.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.LineString.closed\" title=\"django.contrib.gis.geos.LineString.closed\"><code class=\"xref py py-attr docutils literal notranslate\">LineString.closed</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.MultiLineString.closed\" title=\"django.contrib.gis.geos.MultiLineString.closed\"><code class=\"xref py py-attr docutils literal notranslate\">MultiLineString.closed</code></a> properties.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/serializers/\"><span class=\"doc\">GeoJSON serializer</span></a> now outputs the\nprimary key of objects in the <code class=\"docutils literal notranslate\">properties</code> dictionary if specific fields\naren’t specified.</p></li>\n<li><p>The ability to replicate input data on the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALBand.data\" title=\"django.contrib.gis.gdal.GDALBand.data\"><code class=\"xref py py-meth docutils literal notranslate\">GDALBand.data()</code></a> method was added. Band data can\nnow be updated with repeated values efficiently.</p></li>\n<li><p>Added database functions\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.IsValid\" title=\"django.contrib.gis.db.models.functions.IsValid\"><code class=\"xref py py-class docutils literal notranslate\">IsValid</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.MakeValid\" title=\"django.contrib.gis.db.models.functions.MakeValid\"><code class=\"xref py py-class docutils literal notranslate\">MakeValid</code></a>, as well as the\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geoquerysets/#std-fieldlookup-isvalid\"><code class=\"xref std std-lookup docutils literal notranslate\">isvalid</code></a> lookup, all for PostGIS. This allows filtering and\nrepairing invalid geometries on the database side.</p></li>\n<li><p>Added raster support for all <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geoquerysets/\"><span class=\"doc\">spatial lookups</span></a>.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-postgres\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/#module-django.contrib.postgres\" title=\"django.contrib.postgres: PostgreSQL-specific fields and features\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.postgres</code></a><a class=\"heading-anchor\" href=\"#django-contrib-postgres\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>For convenience, <a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/fields/#django.contrib.postgres.fields.HStoreField\" title=\"django.contrib.postgres.fields.HStoreField\"><code class=\"xref py py-class docutils literal notranslate\">HStoreField</code></a> now\ncasts its keys and values to strings.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-sessions\">\n<h4><a class=\"reference internal\" href=\"/en/dev/topics/http/sessions/#module-django.contrib.sessions\" title=\"django.contrib.sessions: Provides session management for Django projects.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.sessions</code></a><a class=\"heading-anchor\" href=\"#django-contrib-sessions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-clearsessions\"><code class=\"xref std std-djadmin docutils literal notranslate\">clearsessions</code></a> management command now removes file-based\nsessions.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-sites\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/sites/#module-django.contrib.sites\" title=\"django.contrib.sites: Lets you operate multiple websites from the same database and Django project\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.sites</code></a><a class=\"heading-anchor\" href=\"#django-contrib-sites\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/contrib/sites/#django.contrib.sites.models.Site\" title=\"django.contrib.sites.models.Site\"><code class=\"xref py py-class docutils literal notranslate\">Site</code></a> model now supports\n<a class=\"reference internal\" href=\"/en/dev/topics/serialization/#topics-serialization-natural-keys\"><span class=\"std std-ref\">natural keys</span></a>.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-staticfiles\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/staticfiles/#module-django.contrib.staticfiles\" title=\"django.contrib.staticfiles: An app for handling static files.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.staticfiles</code></a><a class=\"heading-anchor\" href=\"#django-contrib-staticfiles\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-static\"><code class=\"xref std std-ttag docutils literal notranslate\">static</code></a> template tag now uses <code class=\"docutils literal notranslate\">django.contrib.staticfiles</code>\nif it’s in <code class=\"docutils literal notranslate\">INSTALLED_APPS</code>. This is especially useful for third-party apps\nwhich can now always use <code class=\"docutils literal notranslate\">{% load static %}</code> (instead of\n<code class=\"docutils literal notranslate\">{% load staticfiles %}</code> or <code class=\"docutils literal notranslate\">{% load static from staticfiles %}</code>) and\nnot worry about whether or not the <code class=\"docutils literal notranslate\">staticfiles</code> app is installed.</p></li>\n<li><p>You can <a class=\"reference internal\" href=\"/en/dev/ref/contrib/staticfiles/#customize-staticfiles-ignore-patterns\"><span class=\"std std-ref\">more easily customize</span></a>\nthe <code class=\"docutils literal notranslate\">collectstatic --ignore</code> option with a custom <code class=\"docutils literal notranslate\">AppConfig</code>.</p></li>\n</ul>\n</section>\n<section id=\"cache\">\n<h4>Cache<a class=\"heading-anchor\" href=\"#cache\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The file-based cache backend now uses the highest pickling protocol.</p></li>\n</ul>\n</section>\n<section id=\"csrf\">\n<h4>CSRF<a class=\"heading-anchor\" href=\"#csrf\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The default <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-CSRF_FAILURE_VIEW\"><code class=\"xref std std-setting docutils literal notranslate\">CSRF_FAILURE_VIEW</code></a>, <code class=\"docutils literal notranslate\">views.csrf.csrf_failure()</code> now\naccepts an optional <code class=\"docutils literal notranslate\">template_name</code> parameter, defaulting to\n<code class=\"docutils literal notranslate\">'403_csrf.html'</code>, to control the template used to render the page.</p></li>\n<li><p>To protect against <a class=\"reference external\" href=\"https://www.breachattack.com/\">BREACH</a> attacks, the CSRF protection mechanism now\nchanges the form token value on every request (while keeping an invariant\nsecret which can be used to validate the different tokens).</p></li>\n</ul>\n</section>\n<section id=\"database-backends\">\n<h4>Database backends<a class=\"heading-anchor\" href=\"#database-backends\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Temporal data subtraction was unified on all backends.</p></li>\n<li><p>If the database supports it, backends can set\n<code class=\"docutils literal notranslate\">DatabaseFeatures.can_return_ids_from_bulk_insert=True</code> and implement\n<code class=\"docutils literal notranslate\">DatabaseOperations.fetch_returned_insert_ids()</code> to set primary keys\non objects created using <code class=\"docutils literal notranslate\">QuerySet.bulk_create()</code>.</p></li>\n<li><p>Added keyword arguments to the <code class=\"docutils literal notranslate\">as_sql()</code> methods of various expressions\n(<code class=\"docutils literal notranslate\">Func</code>, <code class=\"docutils literal notranslate\">When</code>, <code class=\"docutils literal notranslate\">Case</code>, and <code class=\"docutils literal notranslate\">OrderBy</code>) to allow database backends to\ncustomize them without mutating <code class=\"docutils literal notranslate\">self</code>, which isn’t safe when using\ndifferent database backends. See the <code class=\"docutils literal notranslate\">arg_joiner</code> and <code class=\"docutils literal notranslate\">**extra_context</code>\nparameters of <a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.Func.as_sql\" title=\"django.db.models.Func.as_sql\"><code class=\"xref py py-meth docutils literal notranslate\">Func.as_sql()</code></a> for an\nexample.</p></li>\n</ul>\n</section>\n<section id=\"file-storage\">\n<h4>File Storage<a class=\"heading-anchor\" href=\"#file-storage\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Storage backends now present a timezone-aware API with new methods\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.get_accessed_time\" title=\"django.core.files.storage.Storage.get_accessed_time\"><code class=\"xref py py-meth docutils literal notranslate\">get_accessed_time()</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.get_created_time\" title=\"django.core.files.storage.Storage.get_created_time\"><code class=\"xref py py-meth docutils literal notranslate\">get_created_time()</code></a>, and\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.get_modified_time\" title=\"django.core.files.storage.Storage.get_modified_time\"><code class=\"xref py py-meth docutils literal notranslate\">get_modified_time()</code></a>. They return a\ntimezone-aware <code class=\"docutils literal notranslate\">datetime</code> if <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-USE_TZ\"><code class=\"xref std std-setting docutils literal notranslate\">USE_TZ</code></a> is <code class=\"docutils literal notranslate\">True</code> and a naive\n<code class=\"docutils literal notranslate\">datetime</code> in the local timezone otherwise.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.generate_filename\" title=\"django.core.files.storage.Storage.generate_filename\"><code class=\"xref py py-meth docutils literal notranslate\">Storage.generate_filename()</code></a> method makes it easier\nto implement custom storages that don’t use the <code class=\"docutils literal notranslate\">os.path</code> calls previously\nin <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\">FileField</code></a>.</p></li>\n</ul>\n</section>\n<section id=\"forms\">\n<h4>Forms<a class=\"heading-anchor\" href=\"#forms\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Form and widget <code class=\"docutils literal notranslate\">Media</code> is now served using\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/staticfiles/#module-django.contrib.staticfiles\" title=\"django.contrib.staticfiles: An app for handling static files.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.staticfiles</code></a> if installed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">&lt;input&gt;</code> tag rendered by <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.CharField\" title=\"django.forms.CharField\"><code class=\"xref py py-class docutils literal notranslate\">CharField</code></a> now includes\na <code class=\"docutils literal notranslate\">minlength</code> attribute if the field has a <code class=\"docutils literal notranslate\">min_length</code>.</p></li>\n<li><p>Required form fields now have the <code class=\"docutils literal notranslate\">required</code> HTML attribute. Set the new\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.use_required_attribute\" title=\"django.forms.Form.use_required_attribute\"><code class=\"xref py py-attr docutils literal notranslate\">Form.use_required_attribute</code></a> attribute to <code class=\"docutils literal notranslate\">False</code> to disable\nit. The <code class=\"docutils literal notranslate\">required</code> attribute isn’t included on forms of formsets because\nthe browser validation may not be correct when adding and deleting formsets.</p></li>\n</ul>\n</section>\n<section id=\"generic-views\">\n<h4>Generic Views<a class=\"heading-anchor\" href=\"#generic-views\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/base/#django.views.generic.base.View\" title=\"django.views.generic.base.View\"><code class=\"xref py py-class docutils literal notranslate\">View</code></a> class can now be imported from\n<code class=\"docutils literal notranslate\">django.views</code>.</p></li>\n</ul>\n</section>\n<section id=\"internationalization\">\n<h4>Internationalization<a class=\"heading-anchor\" href=\"#internationalization\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.conf.urls.i18n.i18n_patterns\" title=\"django.conf.urls.i18n.i18n_patterns\"><code class=\"xref py py-func docutils literal notranslate\">i18n_patterns()</code></a> helper function can now be\nused in a root URLConf specified using <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.urlconf\" title=\"django.http.HttpRequest.urlconf\"><code class=\"xref py py-attr docutils literal notranslate\">request.urlconf</code></a>.</p></li>\n<li><p>By setting the new <code class=\"docutils literal notranslate\">prefix_default_language</code> parameter for\n<a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.conf.urls.i18n.i18n_patterns\" title=\"django.conf.urls.i18n.i18n_patterns\"><code class=\"xref py py-func docutils literal notranslate\">i18n_patterns()</code></a> to <code class=\"docutils literal notranslate\">False</code>, you can allow\naccessing the default language without a URL prefix.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.views.i18n.set_language\" title=\"django.views.i18n.set_language\"><code class=\"xref py py-func docutils literal notranslate\">set_language()</code></a> now returns a 204 status code (No\nContent) for AJAX requests when there is no <code class=\"docutils literal notranslate\">next</code> parameter in <code class=\"docutils literal notranslate\">POST</code> or\n<code class=\"docutils literal notranslate\">GET</code>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.views.i18n.JavaScriptCatalog\" title=\"django.views.i18n.JavaScriptCatalog\"><code class=\"xref py py-class docutils literal notranslate\">JavaScriptCatalog</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.views.i18n.JSONCatalog\" title=\"django.views.i18n.JSONCatalog\"><code class=\"xref py py-class docutils literal notranslate\">JSONCatalog</code></a> class-based views supersede the\ndeprecated <code class=\"docutils literal notranslate\">javascript_catalog()</code> and <code class=\"docutils literal notranslate\">json_catalog()</code> function-based\nviews. The new views are almost equivalent to the old ones except that by\ndefault the new views collect all JavaScript strings in the <code class=\"docutils literal notranslate\">djangojs</code>\ntranslation domain from all installed apps rather than only the JavaScript\nstrings from <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOCALE_PATHS\"><code class=\"xref std std-setting docutils literal notranslate\">LOCALE_PATHS</code></a>.</p></li>\n</ul>\n</section>\n<section id=\"management-commands\">\n<h4>Management Commands<a class=\"heading-anchor\" href=\"#management-commands\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django.core.management.call_command\" title=\"django.core.management.call_command\"><code class=\"xref py py-func docutils literal notranslate\">call_command()</code></a> now returns the value returned\nfrom the <code class=\"docutils literal notranslate\">command.handle()</code> method.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-check-fail-level\"><code class=\"xref std std-option docutils literal notranslate\">check --fail-level</code></a> option allows specifying the message\nlevel that will cause the command to exit with a non-zero status.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-makemigrations-check\"><code class=\"xref std std-option docutils literal notranslate\">makemigrations --check</code></a> option makes the command exit\nwith a non-zero status when model changes without migrations are detected.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-makemigrations\"><code class=\"xref std std-djadmin docutils literal notranslate\">makemigrations</code></a> now displays the path to the migration files that\nit generates.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-shell-interface\"><code class=\"xref std std-option docutils literal notranslate\">shell --interface</code></a> option now accepts <code class=\"docutils literal notranslate\">python</code> to force use of\nthe “plain” Python interpreter.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-shell-command\"><code class=\"xref std std-option docutils literal notranslate\">shell --command</code></a> option lets you run a command as Django and\nexit, instead of opening the interactive shell.</p></li>\n<li><p>Added a warning to <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-dumpdata\"><code class=\"xref std std-djadmin docutils literal notranslate\">dumpdata</code></a> if a proxy model is specified (which\nresults in no output) without its concrete parent.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/howto/custom-management-commands/#django.core.management.BaseCommand.requires_migrations_checks\" title=\"django.core.management.BaseCommand.requires_migrations_checks\"><code class=\"xref py py-attr docutils literal notranslate\">BaseCommand.requires_migrations_checks</code></a> attribute\nmay be set to <code class=\"docutils literal notranslate\">True</code> if you want your command to print a warning, like\n<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-runserver\"><code class=\"xref std std-djadmin docutils literal notranslate\">runserver</code></a> does, if the set of migrations on disk don’t match the\nmigrations in the database.</p></li>\n<li><p>To assist with testing, <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django.core.management.call_command\" title=\"django.core.management.call_command\"><code class=\"xref py py-func docutils literal notranslate\">call_command()</code></a> now\naccepts a command object as the first argument.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-shell\"><code class=\"xref std std-djadmin docutils literal notranslate\">shell</code></a> command supports tab completion on systems using\n<code class=\"docutils literal notranslate\">libedit</code>, e.g. macOS.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-inspectdb\"><code class=\"xref std std-djadmin docutils literal notranslate\">inspectdb</code></a> command lets you choose what tables should be\ninspected by specifying their names as arguments.</p></li>\n</ul>\n</section>\n<section id=\"migrations\">\n<h4>Migrations<a class=\"heading-anchor\" href=\"#migrations\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Added support for serialization of <code class=\"docutils literal notranslate\">enum.Enum</code> objects.</p></li>\n<li><p>Added the <code class=\"docutils literal notranslate\">elidable</code> argument to the\n<a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunSQL\" title=\"django.db.migrations.operations.RunSQL\"><code class=\"xref py py-class docutils literal notranslate\">RunSQL</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunPython\" title=\"django.db.migrations.operations.RunPython\"><code class=\"xref py py-class docutils literal notranslate\">RunPython</code></a> operations to allow them\nto be removed when squashing migrations.</p></li>\n<li><p>Added support for <a class=\"reference internal\" href=\"/en/dev/howto/writing-migrations/#non-atomic-migrations\"><span class=\"std std-ref\">non-atomic migrations</span></a> by\nsetting the <code class=\"docutils literal notranslate\">atomic</code> attribute on a <code class=\"docutils literal notranslate\">Migration</code>.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">migrate</code> and <code class=\"docutils literal notranslate\">makemigrations</code> commands now <a class=\"reference internal\" href=\"/en/dev/topics/migrations/#migration-history-consistency\"><span class=\"std std-ref\">check for a\nconsistent migration history</span></a>. If they find\nsome unapplied dependencies of an applied migration,\n<code class=\"docutils literal notranslate\">InconsistentMigrationHistory</code> is raised.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/signals/#django.db.models.signals.pre_migrate\" title=\"django.db.models.signals.pre_migrate\"><code class=\"xref py py-func docutils literal notranslate\">pre_migrate()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/signals/#django.db.models.signals.post_migrate\" title=\"django.db.models.signals.post_migrate\"><code class=\"xref py py-func docutils literal notranslate\">post_migrate()</code></a> signals now dispatch their\nmigration <code class=\"docutils literal notranslate\">plan</code> and <code class=\"docutils literal notranslate\">apps</code>.</p></li>\n</ul>\n</section>\n<section id=\"models\">\n<h4>Models<a class=\"heading-anchor\" href=\"#models\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Reverse foreign keys from proxy models are now propagated to their\nconcrete class. The reverse relation attached by a\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ForeignKey\" title=\"django.db.models.ForeignKey\"><code class=\"xref py py-class docutils literal notranslate\">ForeignKey</code></a> pointing to a proxy model is now\naccessible as a descriptor on the proxied model class and may be referenced\nin queryset filtering.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.Field.rel_db_type\" title=\"django.db.models.Field.rel_db_type\"><code class=\"xref py py-meth docutils literal notranslate\">Field.rel_db_type()</code></a>\nmethod returns the database column data type for fields such as\n<code class=\"docutils literal notranslate\">ForeignKey</code> and <code class=\"docutils literal notranslate\">OneToOneField</code> that point to another field.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.Func.arity\" title=\"django.db.models.Func.arity\"><code class=\"xref py py-attr docutils literal notranslate\">arity</code></a> class attribute is added to\n<a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.Func\" title=\"django.db.models.Func\"><code class=\"xref py py-class docutils literal notranslate\">Func</code></a>. This attribute can be used to set the number\nof arguments the function accepts.</p></li>\n<li><p>Added <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.BigAutoField\" title=\"django.db.models.BigAutoField\"><code class=\"xref py py-class docutils literal notranslate\">BigAutoField</code></a> which acts much like an\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.AutoField\" title=\"django.db.models.AutoField\"><code class=\"xref py py-class docutils literal notranslate\">AutoField</code></a> except that it is guaranteed\nto fit numbers from <code class=\"docutils literal notranslate\">1</code> to <code class=\"docutils literal notranslate\">9223372036854775807</code>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.in_bulk\" title=\"django.db.models.query.QuerySet.in_bulk\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.in_bulk()</code></a>\nmay be called without any arguments to return all objects in the queryset.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ForeignKey.related_query_name\" title=\"django.db.models.ForeignKey.related_query_name\"><code class=\"xref py py-attr docutils literal notranslate\">related_query_name</code></a> now supports\napp label and class interpolation using the <code class=\"docutils literal notranslate\">'%(app_label)s'</code> and\n<code class=\"docutils literal notranslate\">'%(class)s'</code> strings.</p></li>\n<li><p>Allowed overriding model fields inherited from abstract base classes.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.prefetch_related_objects\" title=\"django.db.models.prefetch_related_objects\"><code class=\"xref py py-func docutils literal notranslate\">prefetch_related_objects()</code></a> function is now a\npublic API.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.bulk_create\" title=\"django.db.models.query.QuerySet.bulk_create\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.bulk_create()</code></a>\nsets the primary key on objects when using PostgreSQL.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.Cast\" title=\"django.db.models.functions.Cast\"><code class=\"xref py py-class docutils literal notranslate\">Cast</code></a> database function.</p></li>\n<li><p>A proxy model may now inherit multiple proxy models that share a common\nnon-abstract parent class.</p></li>\n<li><p>Added <a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.Extract\" title=\"django.db.models.functions.Extract\"><code class=\"xref py py-class docutils literal notranslate\">Extract</code></a> functions to extract\ndatetime components as integers, such as year and hour.</p></li>\n<li><p>Added <a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.Trunc\" title=\"django.db.models.functions.Trunc\"><code class=\"xref py py-class docutils literal notranslate\">Trunc</code></a> functions to truncate a date\nor datetime to a significant component. They enable queries like\nsales-per-day or sales-per-hour.</p></li>\n<li><p><code class=\"docutils literal notranslate\">Model.__init__()</code> now sets values of virtual fields from its keyword\narguments.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/models/options/#django.db.models.Options.base_manager_name\" title=\"django.db.models.Options.base_manager_name\"><code class=\"xref py py-attr docutils literal notranslate\">Meta.base_manager_name</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/options/#django.db.models.Options.default_manager_name\" title=\"django.db.models.Options.default_manager_name\"><code class=\"xref py py-attr docutils literal notranslate\">Meta.default_manager_name</code></a> options allow controlling\nthe <a class=\"reference internal\" href=\"/en/dev/topics/db/managers/#django.db.models.Model._base_manager\" title=\"django.db.models.Model._base_manager\"><code class=\"xref py py-attr docutils literal notranslate\">_base_manager</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/db/managers/#django.db.models.Model._default_manager\" title=\"django.db.models.Model._default_manager\"><code class=\"xref py py-attr docutils literal notranslate\">_default_manager</code></a>, respectively.</p></li>\n</ul>\n</section>\n<section id=\"requests-and-responses\">\n<h4>Requests and Responses<a class=\"heading-anchor\" href=\"#requests-and-responses\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Added <code class=\"docutils literal notranslate\">request.user</code> to the debug view.</p></li>\n<li><p>Added <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a> methods\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse.readable\" title=\"django.http.HttpResponse.readable\"><code class=\"xref py py-meth docutils literal notranslate\">readable()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse.seekable\" title=\"django.http.HttpResponse.seekable\"><code class=\"xref py py-meth docutils literal notranslate\">seekable()</code></a> to make an instance a\nstream-like object and allow wrapping it with <a class=\"reference external\" href=\"https://docs.python.org/3/library/io.html#io.TextIOWrapper\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">io.TextIOWrapper</code></a>.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.content_type\" title=\"django.http.HttpRequest.content_type\"><code class=\"xref py py-attr docutils literal notranslate\">HttpRequest.content_type</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.content_params\" title=\"django.http.HttpRequest.content_params\"><code class=\"xref py py-attr docutils literal notranslate\">content_params</code></a> attributes which are\nparsed from the <code class=\"docutils literal notranslate\">CONTENT_TYPE</code> header.</p></li>\n<li><p>The parser for <code class=\"docutils literal notranslate\">request.COOKIES</code> is simplified to better match the behavior\nof browsers. <code class=\"docutils literal notranslate\">request.COOKIES</code> may now contain cookies that are invalid\naccording to <span class=\"target\" id=\"index-0\"></span><a class=\"rfc reference external\" href=\"https://datatracker.ietf.org/doc/html/rfc6265.html\"><strong>RFC 6265</strong></a> but are possible to set via <code class=\"docutils literal notranslate\">document.cookie</code>.</p></li>\n</ul>\n</section>\n<section id=\"serialization\">\n<h4>Serialization<a class=\"heading-anchor\" href=\"#serialization\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">django.core.serializers.json.DjangoJSONEncoder</code> now knows how to\nserialize lazy strings, typically used for translatable content.</p></li>\n</ul>\n</section>\n<section id=\"templates\">\n<h4>Templates<a class=\"heading-anchor\" href=\"#templates\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Added the <code class=\"docutils literal notranslate\">autoescape</code> option to the\n<a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.backends.django.DjangoTemplates\" title=\"django.template.backends.django.DjangoTemplates\"><code class=\"xref py py-class docutils literal notranslate\">DjangoTemplates</code></a> backend and the\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Engine\" title=\"django.template.Engine\"><code class=\"xref py py-class docutils literal notranslate\">Engine</code></a> class.</p></li>\n<li><p>Added the <code class=\"docutils literal notranslate\">is</code> and <code class=\"docutils literal notranslate\">is not</code> comparison operators to the <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-if\"><code class=\"xref std std-ttag docutils literal notranslate\">if</code></a> tag.</p></li>\n<li><p>Allowed <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-dictsort\"><code class=\"xref std std-tfilter docutils literal notranslate\">dictsort</code></a> to order a list of lists by an element at a\nspecified index.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.context_processors.debug\" title=\"django.template.context_processors.debug\"><code class=\"xref py py-func docutils literal notranslate\">debug()</code></a> context processor\ncontains queries for all database aliases instead of only the default alias.</p></li>\n<li><p>Added relative path support for string arguments of the <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-extends\"><code class=\"xref std std-ttag docutils literal notranslate\">extends</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-include\"><code class=\"xref std std-ttag docutils literal notranslate\">include</code></a> template tags.</p></li>\n</ul>\n</section>\n<section id=\"tests\">\n<h4>Tests<a class=\"heading-anchor\" href=\"#tests\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>To better catch bugs, <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TestCase\" title=\"django.test.TestCase\"><code class=\"xref py py-class docutils literal notranslate\">TestCase</code></a> now checks deferrable\ndatabase constraints at the end of each test.</p></li>\n<li><p>Tests and test cases can be <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#topics-tagging-tests\"><span class=\"std std-ref\">marked with tags</span></a>\nand run selectively with the new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-test-tag\"><code class=\"xref std std-option docutils literal notranslate\">test --tag</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-test-exclude-tag\"><code class=\"xref std std-option docutils literal notranslate\">test\n--exclude-tag</code></a> options.</p></li>\n<li><p>You can now login and use sessions with the test client even if\n<a class=\"reference internal\" href=\"/en/dev/topics/http/sessions/#module-django.contrib.sessions\" title=\"django.contrib.sessions: Provides session management for Django projects.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.sessions</code></a> is not in <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-INSTALLED_APPS\"><code class=\"xref std std-setting docutils literal notranslate\">INSTALLED_APPS</code></a>.</p></li>\n</ul>\n</section>\n<section id=\"urls\">\n<h4>URLs<a class=\"heading-anchor\" href=\"#urls\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>An addition in <a class=\"reference internal\" href=\"/en/dev/ref/applications/#django.setup\" title=\"django.setup\"><code class=\"xref py py-func docutils literal notranslate\">django.setup()</code></a> allows URL resolving that happens\noutside of the request/response cycle (e.g. in management commands and\nstandalone scripts) to take <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-FORCE_SCRIPT_NAME\"><code class=\"xref std std-setting docutils literal notranslate\">FORCE_SCRIPT_NAME</code></a> into account when it\nis set.</p></li>\n</ul>\n</section>\n<section id=\"validators\">\n<h4>Validators<a class=\"heading-anchor\" href=\"#validators\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.URLValidator\" title=\"django.core.validators.URLValidator\"><code class=\"xref py py-class docutils literal notranslate\">URLValidator</code></a> now limits the length of\ndomain name labels to 63 characters and the total length of domain\nnames to 253 characters per <span class=\"target\" id=\"index-1\"></span><a class=\"rfc reference external\" href=\"https://datatracker.ietf.org/doc/html/rfc1034.html\"><strong>RFC 1034</strong></a>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.int_list_validator\" title=\"django.core.validators.int_list_validator\"><code class=\"xref py py-func docutils literal notranslate\">int_list_validator()</code></a> now accepts an optional\n<code class=\"docutils literal notranslate\">allow_negative</code> boolean parameter, defaulting to <code class=\"docutils literal notranslate\">False</code>, to allow\nnegative integers.</p></li>\n</ul>\n</section>\n</section>\n</section>\n<section id=\"backwards-incompatible-changes-in-1-10\">\n<span id=\"backwards-incompatible-1-10\"></span><h2>Backwards incompatible changes in 1.10<a class=\"heading-anchor\" href=\"#backwards-incompatible-changes-in-1-10\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<aside class=\"admonition admonition-warning\" role=\"note\">\n<p class=\"admonition-title\">Warning</p>\n<p>In addition to the changes outlined in this section, be sure to review the\n<a class=\"reference internal\" href=\"#removed-features-1-10\"><span class=\"std std-ref\">Features removed in 1.10</span></a> for the features that have reached the end of\ntheir deprecation cycle and therefore been removed. If you haven’t updated\nyour code within the deprecation timeline for a given feature, its removal\nmay appear as a backwards incompatible change.</p>\n</aside>\n<section id=\"database-backend-api\">\n<h3>Database backend API<a class=\"heading-anchor\" href=\"#database-backend-api\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>GIS’s <code class=\"docutils literal notranslate\">AreaField</code> uses an unspecified underlying numeric type that could in\npractice be any numeric Python type. <code class=\"docutils literal notranslate\">decimal.Decimal</code> values retrieved\nfrom the database are now converted to <code class=\"docutils literal notranslate\">float</code> to make it easier to combine\nthem with values used by the GIS libraries.</p></li>\n<li><p>In order to enable temporal subtraction you must set the\n<code class=\"docutils literal notranslate\">supports_temporal_subtraction</code> database feature flag to <code class=\"docutils literal notranslate\">True</code> and\nimplement the <code class=\"docutils literal notranslate\">DatabaseOperations.subtract_temporals()</code> method. This\nmethod should return the SQL and parameters required to compute the\ndifference in microseconds between the <code class=\"docutils literal notranslate\">lhs</code> and <code class=\"docutils literal notranslate\">rhs</code> arguments in the\ndatatype used to store <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.DurationField\" title=\"django.db.models.DurationField\"><code class=\"xref py py-class docutils literal notranslate\">DurationField</code></a>.</p></li>\n</ul>\n</section>\n<section id=\"select-related-prohibits-non-relational-fields-for-nested-relations\">\n<h3><code class=\"docutils literal notranslate\">select_related()</code> prohibits non-relational fields for nested relations<a class=\"heading-anchor\" href=\"#select-related-prohibits-non-relational-fields-for-nested-relations\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.8 added validation for non-relational fields in <code class=\"docutils literal notranslate\">select_related()</code>:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>select_related<span class=\"p\">(</span><span class=\"s2\">&quot;title&quot;</span><span class=\"p\">)</span>\n<span class=\"gt\">Traceback (most recent call last):</span>\n<span class=\"c\">...</span>\n<span class=\"gr\">FieldError</span>: Non-relational field given in select_related: &#39;title&#39;\n</code></pre></div>\n<p>But it didn’t prohibit nested non-relation fields as it does now:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>select_related<span class=\"p\">(</span><span class=\"s2\">&quot;author__name&quot;</span><span class=\"p\">)</span>\n<span class=\"gt\">Traceback (most recent call last):</span>\n<span class=\"c\">...</span>\n<span class=\"gr\">FieldError</span>: Non-relational field given in select_related: &#39;name&#39;\n</code></pre></div>\n</section>\n<section id=\"meta-get-fields-returns-consistent-reverse-fields-for-proxy-models\">\n<h3><code class=\"docutils literal notranslate\">_meta.get_fields()</code> returns consistent reverse fields for proxy models<a class=\"heading-anchor\" href=\"#meta-get-fields-returns-consistent-reverse-fields-for-proxy-models\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Before Django 1.10, the <a class=\"reference internal\" href=\"/en/dev/ref/models/meta/#django.db.models.options.Options.get_fields\" title=\"django.db.models.options.Options.get_fields\"><code class=\"xref py py-meth docutils literal notranslate\">get_fields()</code></a>\nmethod returned different reverse fields when called on a proxy model compared\nto its proxied concrete class. This inconsistency was fixed by returning the\nfull set of fields pointing to a concrete class or one of its proxies in both\ncases.</p>\n</section>\n<section id=\"abstractuser-username-max-length-increased-to-150\">\n<h3><a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.User.username\" title=\"django.contrib.auth.models.User.username\"><code class=\"xref py py-attr docutils literal notranslate\">AbstractUser.username</code></a> <code class=\"docutils literal notranslate\">max_length</code> increased to 150<a class=\"heading-anchor\" href=\"#abstractuser-username-max-length-increased-to-150\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>A migration for <a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.User.username\" title=\"django.contrib.auth.models.User.username\"><code class=\"xref py py-attr docutils literal notranslate\">django.contrib.auth.models.User.username</code></a> is included.\nIf you have a custom user model inheriting from <code class=\"docutils literal notranslate\">AbstractUser</code>, you’ll need\nto generate and apply a database migration for your user model.</p>\n<p>We considered an increase to 254 characters to more easily allow the use of\nemail addresses (which are limited to 254 characters) as usernames but rejected\nit due to a MySQL limitation. When using the <code class=\"docutils literal notranslate\">utf8mb4</code> encoding (recommended\nfor proper Unicode support), MySQL can only create unique indexes with 191\ncharacters by default. Therefore, if you need a longer length, please use a\ncustom user model.</p>\n<p>If you want to preserve the 30 character limit for usernames, use a custom form\nwhen creating a user or changing usernames:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.contrib.auth.forms</span> <span class=\"kn\">import</span> UserCreationForm\n\n\n<span class=\"k\">class</span> <span class=\"nc\">MyUserCreationForm</span><span class=\"p\">(</span>UserCreationForm<span class=\"p\">):</span>\n    username <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">(</span>\n        max_length<span class=\"o\">=</span><span class=\"mi\">30</span><span class=\"p\">,</span>\n        help_text<span class=\"o\">=</span><span class=\"s2\">&quot;Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.&quot;</span><span class=\"p\">,</span>\n    <span class=\"p\">)</span>\n</code></pre></div>\n<p>If you wish to keep this restriction in the admin, set <code class=\"docutils literal notranslate\">UserAdmin.add_form</code>\nto use this form:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.contrib.auth.admin</span> <span class=\"kn\">import</span> UserAdmin <span class=\"k\">as</span> BaseUserAdmin\n<span class=\"kn\">from</span> <span class=\"nn\">django.contrib.auth.models</span> <span class=\"kn\">import</span> User\n\n\n<span class=\"k\">class</span> <span class=\"nc\">UserAdmin</span><span class=\"p\">(</span>BaseUserAdmin<span class=\"p\">):</span>\n    add_form <span class=\"o\">=</span> MyUserCreationForm\n\n\nadmin<span class=\"o\">.</span>site<span class=\"o\">.</span>unregister<span class=\"p\">(</span>User<span class=\"p\">)</span>\nadmin<span class=\"o\">.</span>site<span class=\"o\">.</span>register<span class=\"p\">(</span>User<span class=\"p\">,</span> UserAdmin<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"dropped-support-for-postgresql-9-1\">\n<h3>Dropped support for PostgreSQL 9.1<a class=\"heading-anchor\" href=\"#dropped-support-for-postgresql-9-1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Upstream support for PostgreSQL 9.1 ends in September 2016. As a consequence,\nDjango 1.10 sets PostgreSQL 9.2 as the minimum version it officially supports.</p>\n</section>\n<section id=\"runserver-output-goes-through-logging\">\n<h3><code class=\"docutils literal notranslate\">runserver</code> output goes through logging<a class=\"heading-anchor\" href=\"#runserver-output-goes-through-logging\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Request and response handling of the <code class=\"docutils literal notranslate\">runserver</code> command is sent to the\n<a class=\"reference internal\" href=\"/en/dev/ref/logging/#django-server-logger\"><span class=\"std std-ref\">django.server</span></a> logger instead of to <code class=\"docutils literal notranslate\">sys.stderr</code>. If you\ndisable Django’s logging configuration or override it with your own, you’ll\nneed to add the appropriate logging configuration if you want to see that\noutput:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>LOGGING <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"c1\"># ...</span>\n    <span class=\"s2\">&quot;formatters&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;django.server&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;()&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.utils.log.ServerFormatter&quot;</span><span class=\"p\">,</span>\n            <span class=\"s2\">&quot;format&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;[</span><span class=\"si\">%(server_time)s</span><span class=\"s2\">] </span><span class=\"si\">%(message)s</span><span class=\"s2\">&quot;</span><span class=\"p\">,</span>\n        <span class=\"p\">}</span>\n    <span class=\"p\">},</span>\n    <span class=\"s2\">&quot;handlers&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;django.server&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;level&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;INFO&quot;</span><span class=\"p\">,</span>\n            <span class=\"s2\">&quot;class&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;logging.StreamHandler&quot;</span><span class=\"p\">,</span>\n            <span class=\"s2\">&quot;formatter&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.server&quot;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n    <span class=\"s2\">&quot;loggers&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;django.server&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;handlers&quot;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s2\">&quot;django.server&quot;</span><span class=\"p\">],</span>\n            <span class=\"s2\">&quot;level&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;INFO&quot;</span><span class=\"p\">,</span>\n            <span class=\"s2\">&quot;propagate&quot;</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">,</span>\n        <span class=\"p\">}</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n</section>\n<section id=\"auth-customuser-and-auth-extensionuser-test-models-were-removed\">\n<h3><code class=\"docutils literal notranslate\">auth.CustomUser</code> and <code class=\"docutils literal notranslate\">auth.ExtensionUser</code> test models were removed<a class=\"heading-anchor\" href=\"#auth-customuser-and-auth-extensionuser-test-models-were-removed\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Since the introduction of migrations for the contrib apps in Django 1.8, the\ntables of these custom user test models were not created anymore making them\nunusable in a testing context.</p>\n</section>\n<section id=\"apps-registry-is-no-longer-auto-populated-when-unpickling-models-outside-of-django\">\n<h3>Apps registry is no longer auto-populated when unpickling models outside of Django<a class=\"heading-anchor\" href=\"#apps-registry-is-no-longer-auto-populated-when-unpickling-models-outside-of-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The apps registry is no longer auto-populated when unpickling models. This was\nadded in Django 1.7.2 as an attempt to allow unpickling models outside of\nDjango, such as in an RQ worker, without calling <code class=\"docutils literal notranslate\">django.setup()</code>, but it\ncreates the possibility of a deadlock. To adapt your code in the case of RQ,\nyou can <a class=\"reference external\" href=\"https://python-rq.org/docs/workers/\">provide your own worker script</a>\nthat calls <code class=\"docutils literal notranslate\">django.setup()</code>.</p>\n</section>\n<section id=\"removed-null-assignment-check-for-non-null-foreign-key-fields\">\n<h3>Removed null assignment check for non-null foreign key fields<a class=\"heading-anchor\" href=\"#removed-null-assignment-check-for-non-null-foreign-key-fields\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In older versions, assigning <code class=\"docutils literal notranslate\">None</code> to a non-nullable <code class=\"docutils literal notranslate\">ForeignKey</code> or\n<code class=\"docutils literal notranslate\">OneToOneField</code> raised <code class=\"docutils literal notranslate\">ValueError('Cannot assign None: &quot;model.field&quot; does\nnot allow null values.')</code>. For consistency with other model fields which don’t\nhave a similar check, this check is removed.</p>\n</section>\n<section id=\"removed-weak-password-hashers-from-the-default-password-hashers-setting\">\n<h3>Removed weak password hashers from the default <code class=\"docutils literal notranslate\">PASSWORD_HASHERS</code> setting<a class=\"heading-anchor\" href=\"#removed-weak-password-hashers-from-the-default-password-hashers-setting\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 0.90 stored passwords as unsalted MD5. Django 0.91 added support for\nsalted SHA1 with automatic upgrade of passwords when a user logs in. Django 1.4\nadded PBKDF2 as the default password hasher.</p>\n<p>If you have an old Django project with MD5 or SHA1 (even salted) encoded\npasswords, be aware that these can be cracked fairly easily with today’s\nhardware. To make Django users acknowledge continued use of weak hashers, the\nfollowing hashers are removed from the default <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-PASSWORD_HASHERS\"><code class=\"xref std std-setting docutils literal notranslate\">PASSWORD_HASHERS</code></a>\nsetting:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">&quot;django.contrib.auth.hashers.SHA1PasswordHasher&quot;</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">&quot;django.contrib.auth.hashers.MD5PasswordHasher&quot;</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">&quot;django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher&quot;</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">&quot;django.contrib.auth.hashers.UnsaltedMD5PasswordHasher&quot;</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">&quot;django.contrib.auth.hashers.CryptPasswordHasher&quot;</code></p></li>\n</ul>\n<p>Consider using a <a class=\"reference internal\" href=\"/en/dev/topics/auth/passwords/#wrapping-password-hashers\"><span class=\"std std-ref\">wrapped password hasher</span></a> to\nstrengthen the hashes in your database. If that’s not feasible, add the\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-PASSWORD_HASHERS\"><code class=\"xref std std-setting docutils literal notranslate\">PASSWORD_HASHERS</code></a> setting to your project and add back any hashers\nthat you need.</p>\n<p>You can check if your database has any of the removed hashers like this:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.contrib.auth</span> <span class=\"kn\">import</span> get_user_model\n\nUser <span class=\"o\">=</span> get_user_model<span class=\"p\">()</span>\n\n<span class=\"c1\"># Unsalted MD5/SHA1:</span>\nUser<span class=\"o\">.</span>objects<span class=\"o\">.</span>filter<span class=\"p\">(</span>password__startswith<span class=\"o\">=</span><span class=\"s2\">&quot;md5$$&quot;</span><span class=\"p\">)</span>\nUser<span class=\"o\">.</span>objects<span class=\"o\">.</span>filter<span class=\"p\">(</span>password__startswith<span class=\"o\">=</span><span class=\"s2\">&quot;sha1$$&quot;</span><span class=\"p\">)</span>\n<span class=\"c1\"># Salted MD5/SHA1:</span>\nUser<span class=\"o\">.</span>objects<span class=\"o\">.</span>filter<span class=\"p\">(</span>password__startswith<span class=\"o\">=</span><span class=\"s2\">&quot;md5$&quot;</span><span class=\"p\">)</span><span class=\"o\">.</span>exclude<span class=\"p\">(</span>password__startswith<span class=\"o\">=</span><span class=\"s2\">&quot;md5$$&quot;</span><span class=\"p\">)</span>\nUser<span class=\"o\">.</span>objects<span class=\"o\">.</span>filter<span class=\"p\">(</span>password__startswith<span class=\"o\">=</span><span class=\"s2\">&quot;sha1$&quot;</span><span class=\"p\">)</span><span class=\"o\">.</span>exclude<span class=\"p\">(</span>password__startswith<span class=\"o\">=</span><span class=\"s2\">&quot;sha1$$&quot;</span><span class=\"p\">)</span>\n<span class=\"c1\"># Crypt hasher:</span>\nUser<span class=\"o\">.</span>objects<span class=\"o\">.</span>filter<span class=\"p\">(</span>password__startswith<span class=\"o\">=</span><span class=\"s2\">&quot;crypt$$&quot;</span><span class=\"p\">)</span>\n\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.models</span> <span class=\"kn\">import</span> CharField\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.models.functions</span> <span class=\"kn\">import</span> Length\n\nCharField<span class=\"o\">.</span>register_lookup<span class=\"p\">(</span>Length<span class=\"p\">)</span>\n<span class=\"c1\"># Unsalted MD5 passwords might not have an &#39;md5$$&#39; prefix:</span>\nUser<span class=\"o\">.</span>objects<span class=\"o\">.</span>filter<span class=\"p\">(</span>password__length<span class=\"o\">=</span><span class=\"mi\">32</span><span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"field-get-prep-lookup-and-field-get-db-prep-lookup-methods-are-removed\">\n<h3><code class=\"docutils literal notranslate\">Field.get_prep_lookup()</code> and <code class=\"docutils literal notranslate\">Field.get_db_prep_lookup()</code> methods are removed<a class=\"heading-anchor\" href=\"#field-get-prep-lookup-and-field-get-db-prep-lookup-methods-are-removed\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you have a custom field that implements either of these methods, register a\ncustom lookup for it. For example:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.db.models</span> <span class=\"kn\">import</span> Field\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.models.lookups</span> <span class=\"kn\">import</span> Exact\n\n\n<span class=\"k\">class</span> <span class=\"nc\">MyField</span><span class=\"p\">(</span>Field<span class=\"p\">):</span> <span class=\"o\">...</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">MyFieldExact</span><span class=\"p\">(</span>Exact<span class=\"p\">):</span>\n    <span class=\"k\">def</span> <span class=\"nf\">get_prep_lookup</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"c1\"># do_custom_stuff_for_myfield</span>\n        <span class=\"o\">...</span>\n\n\nMyField<span class=\"o\">.</span>register_lookup<span class=\"p\">(</span>MyFieldExact<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"id1\">\n<h3><a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/#module-django.contrib.gis\" title=\"django.contrib.gis: Geographic Information System (GIS) extensions for Django\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.gis</code></a><a class=\"heading-anchor\" href=\"#id1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>Support for SpatiaLite &lt; 3.0 and GEOS &lt; 3.3 is dropped.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">add_postgis_srs()</code> backwards compatibility alias for\n<code class=\"docutils literal notranslate\">django.contrib.gis.utils.add_srs_entry()</code> is removed.</p></li>\n<li><p>On Oracle/GIS, the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Area\" title=\"django.contrib.gis.db.models.functions.Area\"><code class=\"xref py py-class docutils literal notranslate\">Area</code></a>\naggregate function now returns a <code class=\"docutils literal notranslate\">float</code> instead of <code class=\"docutils literal notranslate\">decimal.Decimal</code>.\n(It’s still wrapped in a measure of square meters.)</p></li>\n<li><p>The default <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry\" title=\"django.contrib.gis.geos.GEOSGeometry\"><code class=\"xref py py-class docutils literal notranslate\">GEOSGeometry</code></a> representation\n(WKT output) is trimmed by default. That is, instead of <code class=\"docutils literal notranslate\">POINT\n(23.0000000000000000 5.5000000000000000)</code>, you’ll get <code class=\"docutils literal notranslate\">POINT (23 5.5)</code>.</p></li>\n</ul>\n</section>\n<section id=\"maximum-size-of-a-request-body-and-the-number-of-get-post-parameters-is-limited\">\n<h3>Maximum size of a request body and the number of GET/POST parameters is limited<a class=\"heading-anchor\" href=\"#maximum-size-of-a-request-body-and-the-number-of-get-post-parameters-is-limited\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Two new settings help mitigate denial-of-service attacks via large requests:</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATA_UPLOAD_MAX_MEMORY_SIZE\"><code class=\"xref std std-setting docutils literal notranslate\">DATA_UPLOAD_MAX_MEMORY_SIZE</code></a> limits the size that a request body\nmay be. File uploads don’t count toward this limit.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATA_UPLOAD_MAX_NUMBER_FIELDS\"><code class=\"xref std std-setting docutils literal notranslate\">DATA_UPLOAD_MAX_NUMBER_FIELDS</code></a> limits the number of GET/POST\nparameters that are parsed.</p></li>\n</ul>\n<p>Applications that receive unusually large form posts may need to tune these\nsettings.</p>\n</section>\n<section id=\"miscellaneous\">\n<h3>Miscellaneous<a class=\"heading-anchor\" href=\"#miscellaneous\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">repr()</code> of a <code class=\"docutils literal notranslate\">QuerySet</code> is wrapped in <code class=\"docutils literal notranslate\">&lt;QuerySet &gt;</code> to\ndisambiguate it from a plain list when debugging.</p></li>\n<li><p><code class=\"docutils literal notranslate\">utils.version.get_version()</code> returns <span class=\"target\" id=\"index-2\"></span><a class=\"pep reference external\" href=\"https://peps.python.org/pep-0440/\"><strong>PEP 440</strong></a> compliant release\ncandidate versions (e.g. ‘1.10rc1’ instead of ‘1.10c1’).</p></li>\n<li><p>CSRF token values are now required to be strings of 64 alphanumerics; values\nof 32 alphanumerics, as set by older versions of Django by default, are\nautomatically replaced by strings of 64 characters. Other values are\nconsidered invalid. This should only affect developers or users who replace\nthese tokens.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">LOGOUT_URL</code> setting is removed as Django hasn’t made use of it\nsince pre-1.0. If you use it in your project, you can add it to your\nproject’s settings. The default value was <code class=\"docutils literal notranslate\">'/accounts/logout/'</code>.</p></li>\n<li><p>Objects with a <code class=\"docutils literal notranslate\">close()</code> method such as files and generators passed to\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a> are now closed immediately instead of when\nthe WSGI server calls <code class=\"docutils literal notranslate\">close()</code> on the response.</p></li>\n<li><p>A redundant <code class=\"docutils literal notranslate\">transaction.atomic()</code> call in <code class=\"docutils literal notranslate\">QuerySet.update_or_create()</code>\nis removed. This may affect query counts tested by\n<code class=\"docutils literal notranslate\">TransactionTestCase.assertNumQueries()</code>.</p></li>\n<li><p>Support for <code class=\"docutils literal notranslate\">skip_validation</code> in <code class=\"docutils literal notranslate\">BaseCommand.execute(**options)</code> is\nremoved. Use <code class=\"docutils literal notranslate\">skip_checks</code> (added in Django 1.7) instead.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-loaddata\"><code class=\"xref std std-djadmin docutils literal notranslate\">loaddata</code></a> now raises a <code class=\"docutils literal notranslate\">CommandError</code> instead of showing a\nwarning when the specified fixture file is not found.</p></li>\n<li><p>Instead of directly accessing the <code class=\"docutils literal notranslate\">LogEntry.change_message</code> attribute, it’s\nnow better to call the <code class=\"docutils literal notranslate\">LogEntry.get_change_message()</code> method which will\nprovide the message in the current language.</p></li>\n<li><p>The default error views now raise <code class=\"docutils literal notranslate\">TemplateDoesNotExist</code> if a nonexistent\n<code class=\"docutils literal notranslate\">template_name</code> is specified.</p></li>\n<li><p>The unused <code class=\"docutils literal notranslate\">choices</code> keyword argument of the <code class=\"docutils literal notranslate\">Select</code> and\n<code class=\"docutils literal notranslate\">SelectMultiple</code> widgets’ <code class=\"docutils literal notranslate\">render()</code> method is removed. The <code class=\"docutils literal notranslate\">choices</code>\nargument of the <code class=\"docutils literal notranslate\">render_options()</code> method is also removed, making\n<code class=\"docutils literal notranslate\">selected_choices</code> the first argument.</p></li>\n<li><p>Tests that violate deferrable database constraints will now error when run on\na database that supports deferrable constraints.</p></li>\n<li><p>Built-in management commands now use indexing of keys in <code class=\"docutils literal notranslate\">options</code>, e.g.\n<code class=\"docutils literal notranslate\">options['verbosity']</code>, instead of <code class=\"docutils literal notranslate\">options.get()</code> and no longer perform\nany type coercion. This could be a problem if you’re calling commands using\n<code class=\"docutils literal notranslate\">Command.execute()</code> (which bypasses the argument parser that sets a default\nvalue) instead of <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django.core.management.call_command\" title=\"django.core.management.call_command\"><code class=\"xref py py-func docutils literal notranslate\">call_command()</code></a>. Instead of\ncalling <code class=\"docutils literal notranslate\">Command.execute()</code>, pass the command object as the first argument\nto <code class=\"docutils literal notranslate\">call_command()</code>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.backends.ModelBackend\" title=\"django.contrib.auth.backends.ModelBackend\"><code class=\"xref py py-class docutils literal notranslate\">ModelBackend</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.backends.RemoteUserBackend\" title=\"django.contrib.auth.backends.RemoteUserBackend\"><code class=\"xref py py-class docutils literal notranslate\">RemoteUserBackend</code></a> now reject inactive\nusers. This means that inactive users can’t login and will be logged\nout if they are switched from <code class=\"docutils literal notranslate\">is_active=True</code> to <code class=\"docutils literal notranslate\">False</code>. If you need\nthe previous behavior, use the new\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.backends.AllowAllUsersModelBackend\" title=\"django.contrib.auth.backends.AllowAllUsersModelBackend\"><code class=\"xref py py-class docutils literal notranslate\">AllowAllUsersModelBackend</code></a> or\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.backends.AllowAllUsersRemoteUserBackend\" title=\"django.contrib.auth.backends.AllowAllUsersRemoteUserBackend\"><code class=\"xref py py-class docutils literal notranslate\">AllowAllUsersRemoteUserBackend</code></a>\nin <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-AUTHENTICATION_BACKENDS\"><code class=\"xref std std-setting docutils literal notranslate\">AUTHENTICATION_BACKENDS</code></a> instead.</p></li>\n<li><p>In light of the previous change, the test client’s\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.Client.login\" title=\"django.test.Client.login\"><code class=\"xref py py-meth docutils literal notranslate\">login()</code></a> method no longer always rejects inactive\nusers but instead delegates this decision to the authentication backend.\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.Client.force_login\" title=\"django.test.Client.force_login\"><code class=\"xref py py-meth docutils literal notranslate\">force_login()</code></a> also delegates the decision to the\nauthentication backend, so if you’re using the default backends, you need to\nuse an active user.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.views.i18n.set_language\" title=\"django.views.i18n.set_language\"><code class=\"xref py py-func docutils literal notranslate\">django.views.i18n.set_language()</code></a> may now return a 204 status code for\nAJAX requests.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">base_field</code> attribute of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/fields/#django.contrib.postgres.fields.RangeField\" title=\"django.contrib.postgres.fields.RangeField\"><code class=\"xref py py-class docutils literal notranslate\">RangeField</code></a> is now a type of field,\nnot an instance of a field. If you have created a custom subclass of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/fields/#django.contrib.postgres.fields.RangeField\" title=\"django.contrib.postgres.fields.RangeField\"><code class=\"xref py py-class docutils literal notranslate\">RangeField</code></a>, you should change the\n<code class=\"docutils literal notranslate\">base_field</code> attribute.</p></li>\n<li><p>Middleware classes are now initialized when the server starts rather than\nduring the first request.</p></li>\n<li><p>If you override <code class=\"docutils literal notranslate\">is_authenticated()</code> or <code class=\"docutils literal notranslate\">is_anonymous()</code> in a custom user\nmodel, you must convert them to attributes or properties as described in\n<a class=\"reference internal\" href=\"#user-is-auth-anon-deprecation\"><span class=\"std std-ref\">the deprecation note</span></a>.</p></li>\n<li><p>When using <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_as\" title=\"django.contrib.admin.ModelAdmin.save_as\"><code class=\"xref py py-attr docutils literal notranslate\">ModelAdmin.save_as=True</code></a>, the “Save as new” button now\nredirects to the change view for the new object instead of to the model’s\nchangelist. If you need the previous behavior, set the new\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_as_continue\" title=\"django.contrib.admin.ModelAdmin.save_as_continue\"><code class=\"xref py py-attr docutils literal notranslate\">ModelAdmin.save_as_continue</code></a> attribute to <code class=\"docutils literal notranslate\">False</code>.</p></li>\n<li><p>Required form fields now have the <code class=\"docutils literal notranslate\">required</code> HTML attribute. Set the\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.use_required_attribute\" title=\"django.forms.Form.use_required_attribute\"><code class=\"xref py py-attr docutils literal notranslate\">Form.use_required_attribute</code></a>\nattribute to <code class=\"docutils literal notranslate\">False</code> to disable it. You could also add the <code class=\"docutils literal notranslate\">novalidate</code>\nattribute to <code class=\"docutils literal notranslate\">&lt;form&gt;</code> if you don’t want browser validation. To disable\nthe <code class=\"docutils literal notranslate\">required</code> attribute on custom widgets, override the\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.Widget.use_required_attribute\" title=\"django.forms.Widget.use_required_attribute\"><code class=\"xref py py-meth docutils literal notranslate\">Widget.use_required_attribute()</code></a>\nmethod.</p></li>\n<li><p>The WSGI handler no longer removes content of responses from <code class=\"docutils literal notranslate\">HEAD</code>\nrequests or responses with a <code class=\"docutils literal notranslate\">status_code</code> of 100-199, 204, or 304. Most\nweb servers already implement this behavior. Responses retrieved using the\nDjango test client continue to have these “response fixes” applied.</p></li>\n<li><p><code class=\"docutils literal notranslate\">Model.__init__()</code> now receives <code class=\"docutils literal notranslate\">django.db.models.DEFERRED</code> as the value\nof deferred fields.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">Model._deferred</code> attribute is removed as dynamic model classes when\nusing <code class=\"docutils literal notranslate\">QuerySet.defer()</code> and <code class=\"docutils literal notranslate\">only()</code> is removed.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.save\" title=\"django.core.files.storage.Storage.save\"><code class=\"xref py py-meth docutils literal notranslate\">Storage.save()</code></a> no longer\nreplaces <code class=\"docutils literal notranslate\">'\\'</code> with <code class=\"docutils literal notranslate\">'/'</code>. This behavior is moved to\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.FileSystemStorage\" title=\"django.core.files.storage.FileSystemStorage\"><code class=\"xref py py-class docutils literal notranslate\">FileSystemStorage</code></a> since this is a storage\nspecific implementation detail. Any Windows user with a custom storage\nimplementation that relies on this behavior will need to implement it in the\ncustom storage’s <code class=\"docutils literal notranslate\">save()</code> method.</p></li>\n<li><p>Private <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\">FileField</code></a> methods <code class=\"docutils literal notranslate\">get_directory_name()</code>\nand <code class=\"docutils literal notranslate\">get_filename()</code> are no longer called (and are now deprecated) which is\na backwards incompatible change for users overriding those methods on custom\nfields. To adapt such code, override <code class=\"docutils literal notranslate\">FileField.generate_filename()</code> or\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.generate_filename\" title=\"django.core.files.storage.Storage.generate_filename\"><code class=\"xref py py-meth docutils literal notranslate\">Storage.generate_filename()</code></a> instead. It\nmight be possible to use <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.FileField.upload_to\" title=\"django.db.models.FileField.upload_to\"><code class=\"xref py py-attr docutils literal notranslate\">upload_to</code></a> also.</p></li>\n<li><p>The subject of mail sent by <code class=\"docutils literal notranslate\">AdminEmailHandler</code> is no longer truncated at\n989 characters. If you were counting on a limited length, truncate the\nsubject yourself.</p></li>\n<li><p>Private expressions <code class=\"docutils literal notranslate\">django.db.models.expressions.Date</code> and <code class=\"docutils literal notranslate\">DateTime</code>\nare removed. The new <a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.Trunc\" title=\"django.db.models.functions.Trunc\"><code class=\"xref py py-class docutils literal notranslate\">Trunc</code></a> expressions\nprovide the same functionality.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">_base_manager</code> and <code class=\"docutils literal notranslate\">_default_manager</code> attributes are removed from\nmodel instances. They remain accessible on the model class.</p></li>\n<li><p>Accessing a deleted field on a model instance, e.g. after <code class=\"docutils literal notranslate\">del obj.field</code>,\nreloads the field’s value instead of raising <code class=\"docutils literal notranslate\">AttributeError</code>.</p></li>\n<li><p>If you subclass <code class=\"docutils literal notranslate\">AbstractBaseUser</code> and override <code class=\"docutils literal notranslate\">clean()</code>, be sure it\ncalls <code class=\"docutils literal notranslate\">super()</code>. <a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.models.AbstractBaseUser.normalize_username\" title=\"django.contrib.auth.models.AbstractBaseUser.normalize_username\"><code class=\"xref py py-meth docutils literal notranslate\">AbstractBaseUser.normalize_username()</code></a> is called in\na new <a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.models.AbstractBaseUser.clean\" title=\"django.contrib.auth.models.AbstractBaseUser.clean\"><code class=\"xref py py-meth docutils literal notranslate\">AbstractBaseUser.clean()</code></a> method.</p></li>\n<li><p>Private API <code class=\"docutils literal notranslate\">django.forms.models.model_to_dict()</code> returns a queryset rather\nthan a list of primary keys for <code class=\"docutils literal notranslate\">ManyToManyField</code>s.</p></li>\n<li><p>If <code class=\"docutils literal notranslate\">django.contrib.staticfiles</code> is\ninstalled, the <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-static\"><code class=\"xref std std-ttag docutils literal notranslate\">static</code></a>  template tag uses the <code class=\"docutils literal notranslate\">staticfiles</code> storage\nto construct the URL rather than simply joining the value with\n<code class=\"docutils literal notranslate\">STATIC_ROOT</code>. The new approach encodes the URL, which could be\nbackwards-incompatible in cases such as including a fragment in a path, e.g.\n<code class=\"docutils literal notranslate\">{% static 'img.svg#fragment' %}</code>, since the <code class=\"docutils literal notranslate\">#</code> is encoded as <code class=\"docutils literal notranslate\">%23</code>.\nTo adapt, move the fragment outside the template tag:\n<code class=\"docutils literal notranslate\">{% static 'img.svg' %}#fragment</code>.</p></li>\n<li><p>When <code class=\"docutils literal notranslate\">USE_L10N</code> is <code class=\"docutils literal notranslate\">True</code>, localization is now applied for the\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-date\"><code class=\"xref std std-tfilter docutils literal notranslate\">date</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-time\"><code class=\"xref std std-tfilter docutils literal notranslate\">time</code></a> filters when no format string is\nspecified. The <code class=\"docutils literal notranslate\">DATE_FORMAT</code> and <code class=\"docutils literal notranslate\">TIME_FORMAT</code> specifiers from the active\nlocale are used instead of the settings of the same name.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"features-deprecated-in-1-10\">\n<span id=\"deprecated-features-1-10\"></span><h2>Features deprecated in 1.10<a class=\"heading-anchor\" href=\"#features-deprecated-in-1-10\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"direct-assignment-to-a-reverse-foreign-key-or-many-to-many-relation\">\n<h3>Direct assignment to a reverse foreign key or many-to-many relation<a class=\"heading-anchor\" href=\"#direct-assignment-to-a-reverse-foreign-key-or-many-to-many-relation\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Instead of assigning related objects using direct assignment:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>new_list <span class=\"o\">=</span> <span class=\"p\">[</span>obj1<span class=\"p\">,</span> obj2<span class=\"p\">,</span> obj3<span class=\"p\">]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>e<span class=\"o\">.</span>related_set <span class=\"o\">=</span> new_list\n</code></pre></div>\n<p>Use the <a class=\"reference internal\" href=\"/en/dev/ref/models/relations/#django.db.models.fields.related.RelatedManager.set\" title=\"django.db.models.fields.related.RelatedManager.set\"><code class=\"xref py py-meth docutils literal notranslate\">set()</code></a> method\nadded in Django 1.9:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>e<span class=\"o\">.</span>related_set<span class=\"o\">.</span>set<span class=\"p\">([</span>obj1<span class=\"p\">,</span> obj2<span class=\"p\">,</span> obj3<span class=\"p\">])</span>\n</code></pre></div>\n<p>This prevents confusion about an assignment resulting in an implicit save.</p>\n</section>\n<section id=\"non-timezone-aware-storage-api\">\n<h3>Non-timezone-aware <a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage\" title=\"django.core.files.storage.Storage\"><code class=\"xref py py-class docutils literal notranslate\">Storage</code></a> API<a class=\"heading-anchor\" href=\"#non-timezone-aware-storage-api\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The old, non-timezone-aware methods <code class=\"docutils literal notranslate\">accessed_time()</code>, <code class=\"docutils literal notranslate\">created_time()</code>,\nand <code class=\"docutils literal notranslate\">modified_time()</code> are deprecated in favor of the new <code class=\"docutils literal notranslate\">get_*_time()</code>\nmethods.</p>\n<p>Third-party storage backends should implement the new methods and mark the old\nones as deprecated. Until then, the new <code class=\"docutils literal notranslate\">get_*_time()</code> methods on the base\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage\" title=\"django.core.files.storage.Storage\"><code class=\"xref py py-class docutils literal notranslate\">Storage</code></a> class convert <code class=\"docutils literal notranslate\">datetime</code>s from\nthe old methods as required and emit a deprecation warning as they do so.</p>\n<p>Third-party storage backends may retain the old methods as long as they\nwish to support earlier versions of Django.</p>\n</section>\n<section id=\"id2\">\n<h3><a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/#module-django.contrib.gis\" title=\"django.contrib.gis: Geographic Information System (GIS) extensions for Django\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.gis</code></a><a class=\"heading-anchor\" href=\"#id2\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">get_srid()</code> and <code class=\"docutils literal notranslate\">set_srid()</code> methods of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry\" title=\"django.contrib.gis.geos.GEOSGeometry\"><code class=\"xref py py-class docutils literal notranslate\">GEOSGeometry</code></a> are deprecated in favor\nof the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.srid\" title=\"django.contrib.gis.geos.GEOSGeometry.srid\"><code class=\"xref py py-attr docutils literal notranslate\">srid</code></a> property.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">get_x()</code>, <code class=\"docutils literal notranslate\">set_x()</code>, <code class=\"docutils literal notranslate\">get_y()</code>, <code class=\"docutils literal notranslate\">set_y()</code>, <code class=\"docutils literal notranslate\">get_z()</code>, and\n<code class=\"docutils literal notranslate\">set_z()</code> methods of <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.Point\" title=\"django.contrib.gis.geos.Point\"><code class=\"xref py py-class docutils literal notranslate\">Point</code></a> are deprecated\nin favor of the <code class=\"docutils literal notranslate\">x</code>, <code class=\"docutils literal notranslate\">y</code>, and <code class=\"docutils literal notranslate\">z</code> properties.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">get_coords()</code> and <code class=\"docutils literal notranslate\">set_coords()</code> methods of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.Point\" title=\"django.contrib.gis.geos.Point\"><code class=\"xref py py-class docutils literal notranslate\">Point</code></a> are deprecated in favor of the\n<code class=\"docutils literal notranslate\">tuple</code> property.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">cascaded_union</code> property of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.MultiPolygon\" title=\"django.contrib.gis.geos.MultiPolygon\"><code class=\"xref py py-class docutils literal notranslate\">MultiPolygon</code></a> is deprecated in favor of the\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.unary_union\" title=\"django.contrib.gis.geos.GEOSGeometry.unary_union\"><code class=\"xref py py-attr docutils literal notranslate\">unary_union</code></a> property.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">django.contrib.gis.utils.precision_wkt()</code> function is deprecated in\nfavor of <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.WKTWriter\" title=\"django.contrib.gis.geos.WKTWriter\"><code class=\"xref py py-class docutils literal notranslate\">WKTWriter</code></a>.</p></li>\n</ul>\n</section>\n<section id=\"commaseparatedintegerfield-model-field\">\n<h3><code class=\"docutils literal notranslate\">CommaSeparatedIntegerField</code> model field<a class=\"heading-anchor\" href=\"#commaseparatedintegerfield-model-field\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">CommaSeparatedIntegerField</code> is deprecated in favor of\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.CharField\" title=\"django.db.models.CharField\"><code class=\"xref py py-class docutils literal notranslate\">CharField</code></a> with the\n<a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.validate_comma_separated_integer_list\" title=\"django.core.validators.validate_comma_separated_integer_list\"><code class=\"xref py py-func docutils literal notranslate\">validate_comma_separated_integer_list()</code></a>\nvalidator:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.core.validators</span> <span class=\"kn\">import</span> validate_comma_separated_integer_list\n<span class=\"kn\">from</span> <span class=\"nn\">django.db</span> <span class=\"kn\">import</span> models\n\n\n<span class=\"k\">class</span> <span class=\"nc\">MyModel</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    numbers <span class=\"o\">=</span> models<span class=\"o\">.</span>CharField<span class=\"p\">(</span><span class=\"o\">...</span><span class=\"p\">,</span> validators<span class=\"o\">=</span><span class=\"p\">[</span>validate_comma_separated_integer_list<span class=\"p\">])</span>\n</code></pre></div>\n<p>If you’re using Oracle, <code class=\"docutils literal notranslate\">CharField</code> uses a different database field  type\n(<code class=\"docutils literal notranslate\">NVARCHAR2</code>) than <code class=\"docutils literal notranslate\">CommaSeparatedIntegerField</code> (<code class=\"docutils literal notranslate\">VARCHAR2</code>). Depending\non your database settings, this might imply a different encoding, and thus a\ndifferent length (in bytes) for the same contents. If your stored values are\nlonger than the 4000 byte limit of <code class=\"docutils literal notranslate\">NVARCHAR2</code>, you should use <code class=\"docutils literal notranslate\">TextField</code>\n(<code class=\"docutils literal notranslate\">NCLOB</code>) instead. In this case, if you have any queries that group by the\nfield (e.g. annotating the model with an aggregation or using <code class=\"docutils literal notranslate\">distinct()</code>)\nyou’ll need to change them (to defer the field).</p>\n</section>\n<section id=\"using-a-model-name-as-a-query-lookup-when-default-related-name-is-set\">\n<h3>Using a model name as a query lookup when <code class=\"docutils literal notranslate\">default_related_name</code> is set<a class=\"heading-anchor\" href=\"#using-a-model-name-as-a-query-lookup-when-default-related-name-is-set\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Assume the following models:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.db</span> <span class=\"kn\">import</span> models\n\n\n<span class=\"k\">class</span> <span class=\"nc\">Foo</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    <span class=\"k\">pass</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">Bar</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    foo <span class=\"o\">=</span> models<span class=\"o\">.</span>ForeignKey<span class=\"p\">(</span>Foo<span class=\"p\">)</span>\n\n    <span class=\"k\">class</span> <span class=\"nc\">Meta</span><span class=\"p\">:</span>\n        default_related_name <span class=\"o\">=</span> <span class=\"s2\">&quot;bars&quot;</span>\n</code></pre></div>\n<p>In older versions, <a class=\"reference internal\" href=\"/en/dev/ref/models/options/#django.db.models.Options.default_related_name\" title=\"django.db.models.Options.default_related_name\"><code class=\"xref py py-attr docutils literal notranslate\">default_related_name</code></a>\ncouldn’t be used as a query lookup. This is fixed and support for the old\nlookup name is deprecated. For example, since <code class=\"docutils literal notranslate\">default_related_name</code> is set\nin model <code class=\"docutils literal notranslate\">Bar</code>, instead of using the model name <code class=\"docutils literal notranslate\">bar</code> as the lookup:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>bar <span class=\"o\">=</span> Bar<span class=\"o\">.</span>objects<span class=\"o\">.</span>get<span class=\"p\">(</span>pk<span class=\"o\">=</span><span class=\"mi\">1</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>Foo<span class=\"o\">.</span>objects<span class=\"o\">.</span>get<span class=\"p\">(</span>bar<span class=\"o\">=</span>bar<span class=\"p\">)</span>\n</code></pre></div>\n<p>use the default_related_name <code class=\"docutils literal notranslate\">bars</code>:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>Foo<span class=\"o\">.</span>objects<span class=\"o\">.</span>get<span class=\"p\">(</span>bars<span class=\"o\">=</span>bar<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"search-query-lookup\">\n<span id=\"search-lookup-replacement\"></span><h3><code class=\"docutils literal notranslate\">__search</code> query lookup<a class=\"heading-anchor\" href=\"#search-query-lookup\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">search</code> lookup, which supports MySQL only and is extremely limited in\nfeatures, is deprecated. Replace it with a custom lookup:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.db</span> <span class=\"kn\">import</span> models\n\n\n<span class=\"k\">class</span> <span class=\"nc\">Search</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Lookup<span class=\"p\">):</span>\n    lookup_name <span class=\"o\">=</span> <span class=\"s2\">&quot;search&quot;</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">as_mysql</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> compiler<span class=\"p\">,</span> connection<span class=\"p\">):</span>\n        lhs<span class=\"p\">,</span> lhs_params <span class=\"o\">=</span> <span class=\"bp\">self</span><span class=\"o\">.</span>process_lhs<span class=\"p\">(</span>compiler<span class=\"p\">,</span> connection<span class=\"p\">)</span>\n        rhs<span class=\"p\">,</span> rhs_params <span class=\"o\">=</span> <span class=\"bp\">self</span><span class=\"o\">.</span>process_rhs<span class=\"p\">(</span>compiler<span class=\"p\">,</span> connection<span class=\"p\">)</span>\n        params <span class=\"o\">=</span> lhs_params <span class=\"o\">+</span> rhs_params\n        <span class=\"k\">return</span> <span class=\"s2\">&quot;MATCH (</span><span class=\"si\">%s</span><span class=\"s2\">) AGAINST (</span><span class=\"si\">%s</span><span class=\"s2\"> IN BOOLEAN MODE)&quot;</span> <span class=\"o\">%</span> <span class=\"p\">(</span>lhs<span class=\"p\">,</span> rhs<span class=\"p\">),</span> params\n\n\nmodels<span class=\"o\">.</span>CharField<span class=\"o\">.</span>register_lookup<span class=\"p\">(</span>Search<span class=\"p\">)</span>\nmodels<span class=\"o\">.</span>TextField<span class=\"o\">.</span>register_lookup<span class=\"p\">(</span>Search<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"using-user-is-authenticated-and-user-is-anonymous-as-methods\">\n<span id=\"user-is-auth-anon-deprecation\"></span><h3>Using <code class=\"docutils literal notranslate\">User.is_authenticated()</code> and <code class=\"docutils literal notranslate\">User.is_anonymous()</code> as methods<a class=\"heading-anchor\" href=\"#using-user-is-authenticated-and-user-is-anonymous-as-methods\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">is_authenticated()</code> and <code class=\"docutils literal notranslate\">is_anonymous()</code> methods of\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.models.AbstractBaseUser\" title=\"django.contrib.auth.models.AbstractBaseUser\"><code class=\"xref py py-class docutils literal notranslate\">AbstractBaseUser</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.AnonymousUser\" title=\"django.contrib.auth.models.AnonymousUser\"><code class=\"xref py py-class docutils literal notranslate\">AnonymousUser</code></a> classes are now\nproperties. They will still work as methods until Django 2.0, but all usage\nin Django now uses attribute access.</p>\n<p>For example, if you use\n<a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.contrib.auth.middleware.AuthenticationMiddleware\" title=\"django.contrib.auth.middleware.AuthenticationMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">AuthenticationMiddleware</code></a> and want\nto know whether the user is currently logged-in you would use:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"k\">if</span> request<span class=\"o\">.</span>user<span class=\"o\">.</span>is_authenticated<span class=\"p\">:</span>\n    <span class=\"o\">...</span>  <span class=\"c1\"># Do something for logged-in users.</span>\n<span class=\"k\">else</span><span class=\"p\">:</span>\n    <span class=\"o\">...</span>  <span class=\"c1\"># Do something for anonymous users.</span>\n</code></pre></div>\n<p>instead of <code class=\"docutils literal notranslate\">request.user.is_authenticated()</code>.</p>\n<p>This change avoids accidental information leakage if you forget to call the\nmethod, e.g.:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"k\">if</span> request<span class=\"o\">.</span>user<span class=\"o\">.</span>is_authenticated<span class=\"p\">:</span>\n    <span class=\"k\">return</span> sensitive_information\n</code></pre></div>\n<p>If you override these methods in a custom user model, you must change them to\nproperties or attributes.</p>\n<p>Django uses a <code class=\"docutils literal notranslate\">CallableBool</code> object to allow these attributes to work as both\na property and a method. Thus, until the deprecation period ends, you cannot\ncompare these properties using the <code class=\"docutils literal notranslate\">is</code> operator. That is, the following\nwon’t work:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"k\">if</span> request<span class=\"o\">.</span>user<span class=\"o\">.</span>is_authenticated <span class=\"ow\">is</span> <span class=\"kc\">True</span><span class=\"p\">:</span>\n    <span class=\"o\">...</span>\n</code></pre></div>\n</section>\n<section id=\"custom-manager-classes-available-through-prefetch-related-must-define-a-apply-rel-filters-method\">\n<h3>Custom manager classes available through <code class=\"docutils literal notranslate\">prefetch_related</code> must define a <code class=\"docutils literal notranslate\">_apply_rel_filters()</code> method<a class=\"heading-anchor\" href=\"#custom-manager-classes-available-through-prefetch-related-must-define-a-apply-rel-filters-method\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you defined a custom manager class available through\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.prefetch_related\" title=\"django.db.models.query.QuerySet.prefetch_related\"><code class=\"xref py py-meth docutils literal notranslate\">prefetch_related()</code></a> you must make sure\nit defines a <code class=\"docutils literal notranslate\">_apply_rel_filters()</code> method.</p>\n<p>This method must accept a <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet\" title=\"django.db.models.query.QuerySet\"><code class=\"xref py py-class docutils literal notranslate\">QuerySet</code></a> instance\nas its single argument and return a filtered version of the queryset for the\nmodel instance the manager is bound to.</p>\n</section>\n<section id=\"the-escape-half-of-django-utils-safestring\">\n<h3>The “escape” half of <code class=\"docutils literal notranslate\">django.utils.safestring</code><a class=\"heading-anchor\" href=\"#the-escape-half-of-django-utils-safestring\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">mark_for_escaping()</code> function and the classes it uses: <code class=\"docutils literal notranslate\">EscapeData</code>,\n<code class=\"docutils literal notranslate\">EscapeBytes</code>, <code class=\"docutils literal notranslate\">EscapeText</code>, <code class=\"docutils literal notranslate\">EscapeString</code>, and <code class=\"docutils literal notranslate\">EscapeUnicode</code> are\ndeprecated.</p>\n<p>As a result, the “lazy” behavior of the <code class=\"docutils literal notranslate\">escape</code> filter (where it would\nalways be applied as the last filter no matter where in the filter chain it\nappeared) is deprecated. The filter will change to immediately apply\n<a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.html.conditional_escape\" title=\"django.utils.html.conditional_escape\"><code class=\"xref py py-func docutils literal notranslate\">conditional_escape()</code></a> in Django 2.0.</p>\n</section>\n<section id=\"manager-use-for-related-fields-and-inheritance-changes\">\n<h3><code class=\"docutils literal notranslate\">Manager.use_for_related_fields</code> and inheritance changes<a class=\"heading-anchor\" href=\"#manager-use-for-related-fields-and-inheritance-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">Manager.use_for_related_fields</code> is deprecated in favor of setting\n<a class=\"reference internal\" href=\"/en/dev/ref/models/options/#django.db.models.Options.base_manager_name\" title=\"django.db.models.Options.base_manager_name\"><code class=\"xref py py-attr docutils literal notranslate\">Meta.base_manager_name</code></a> on\nthe model.</p>\n<p>Model <code class=\"docutils literal notranslate\">Manager</code> inheritance will follow MRO inheritance rules in Django 2.0,\nchanging the current behavior where managers defined on non-abstract base\nclasses aren’t inherited by child classes. A deprecating warning with\ninstructions on how to adapt your code is raised if you have any affected\nmanagers. You’ll either redeclare a manager from an abstract model on the child\nclass to override the manager from the concrete model, or you’ll set the\nmodel’s <code class=\"docutils literal notranslate\">Meta.manager_inheritance_from_future=True</code> option to opt-in to the\nnew inheritance behavior.</p>\n<p>During the deprecation period, <code class=\"docutils literal notranslate\">use_for_related_fields</code> will be honored and\nraise a warning, even if a <code class=\"docutils literal notranslate\">base_manager_name</code> is set. This allows\nthird-party code to preserve legacy behavior while transitioning to the new\nAPI. The warning can be silenced by setting\n<code class=\"docutils literal notranslate\">silence_use_for_related_fields_deprecation=True</code> on the manager.</p>\n</section>\n<section id=\"id3\">\n<h3>Miscellaneous<a class=\"heading-anchor\" href=\"#id3\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">makemigrations --exit</code> option is deprecated in favor of the\n<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-makemigrations-check\"><code class=\"xref std std-option docutils literal notranslate\">makemigrations --check</code></a> option.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.functional.allow_lazy()</code> is deprecated in favor of the new\n<a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.functional.keep_lazy\" title=\"django.utils.functional.keep_lazy\"><code class=\"xref py py-func docutils literal notranslate\">keep_lazy()</code></a> function which can be used with a\nmore natural decorator syntax.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">shell --plain</code> option is deprecated in favor of <code class=\"docutils literal notranslate\">-i python</code> or\n<code class=\"docutils literal notranslate\">--interface python</code>.</p></li>\n<li><p>Importing from the <code class=\"docutils literal notranslate\">django.core.urlresolvers</code> module is deprecated in\nfavor of its new location, <a class=\"reference internal\" href=\"/en/dev/ref/urlresolvers/#module-django.urls\" title=\"django.urls\"><code class=\"xref py py-mod docutils literal notranslate\">django.urls</code></a>.</p></li>\n<li><p>The template <code class=\"docutils literal notranslate\">Context.has_key()</code> method is deprecated in favor of <code class=\"docutils literal notranslate\">in</code>.</p></li>\n<li><p>The private attribute <code class=\"docutils literal notranslate\">virtual_fields</code> of <code class=\"docutils literal notranslate\">Model._meta</code> is\ndeprecated in favor of <code class=\"docutils literal notranslate\">private_fields</code>.</p></li>\n<li><p>The private keyword arguments <code class=\"docutils literal notranslate\">virtual_only</code> in\n<code class=\"docutils literal notranslate\">Field.contribute_to_class()</code> and <code class=\"docutils literal notranslate\">virtual</code> in\n<code class=\"docutils literal notranslate\">Model._meta.add_field()</code> are deprecated in favor of <code class=\"docutils literal notranslate\">private_only</code>\nand <code class=\"docutils literal notranslate\">private</code>, respectively.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">javascript_catalog()</code> and <code class=\"docutils literal notranslate\">json_catalog()</code> views are deprecated in\nfavor of class-based views <a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.views.i18n.JavaScriptCatalog\" title=\"django.views.i18n.JavaScriptCatalog\"><code class=\"xref py py-class docutils literal notranslate\">JavaScriptCatalog</code></a>\nand <a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.views.i18n.JSONCatalog\" title=\"django.views.i18n.JSONCatalog\"><code class=\"xref py py-class docutils literal notranslate\">JSONCatalog</code></a>.</p></li>\n<li><p>In multi-table inheritance, implicit promotion of a <code class=\"docutils literal notranslate\">OneToOneField</code> to a\n<code class=\"docutils literal notranslate\">parent_link</code> is deprecated. Add <code class=\"docutils literal notranslate\">parent_link=True</code> to such fields.</p></li>\n<li><p>The private API <code class=\"docutils literal notranslate\">Widget._format_value()</code> is made public and renamed to\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.Widget.format_value\" title=\"django.forms.Widget.format_value\"><code class=\"xref py py-meth docutils literal notranslate\">format_value()</code></a>. The old name will work\nthrough a deprecation period.</p></li>\n<li><p>Private <code class=\"docutils literal notranslate\">FileField</code> methods <code class=\"docutils literal notranslate\">get_directory_name()</code> and <code class=\"docutils literal notranslate\">get_filename()</code>\nare deprecated in favor of performing this work in\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.generate_filename\" title=\"django.core.files.storage.Storage.generate_filename\"><code class=\"xref py py-meth docutils literal notranslate\">Storage.generate_filename()</code></a>.</p></li>\n<li><p>Old-style middleware that uses  <code class=\"docutils literal notranslate\">settings.MIDDLEWARE_CLASSES</code> are\ndeprecated. <a class=\"reference internal\" href=\"/en/dev/topics/http/middleware/#upgrading-middleware\"><span class=\"std std-ref\">Adapt old, custom middleware</span></a> and\nuse the new <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-MIDDLEWARE\"><code class=\"xref std std-setting docutils literal notranslate\">MIDDLEWARE</code></a> setting.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"features-removed-in-1-10\">\n<span id=\"removed-features-1-10\"></span><h2>Features removed in 1.10<a class=\"heading-anchor\" href=\"#features-removed-in-1-10\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>These features have reached the end of their deprecation cycle and are removed\nin Django 1.10. See <a class=\"reference internal\" href=\"/en/dev/releases/1.8/#deprecated-features-1-8\"><span class=\"std std-ref\">Features deprecated in 1.8</span></a> for details, including how\nto remove usage of these features.</p>\n<ul class=\"simple\">\n<li><p>Support for calling a <code class=\"docutils literal notranslate\">SQLCompiler</code> directly as an alias for calling its\n<code class=\"docutils literal notranslate\">quote_name_unless_alias</code> method is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">cycle</code> and <code class=\"docutils literal notranslate\">firstof</code> template tags are removed from the <code class=\"docutils literal notranslate\">future</code>\ntemplate tag library.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.conf.urls.patterns()</code> is removed.</p></li>\n<li><p>Support for the <code class=\"docutils literal notranslate\">prefix</code> argument to\n<code class=\"docutils literal notranslate\">django.conf.urls.i18n.i18n_patterns()</code> is removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">SimpleTestCase.urls</code> is removed.</p></li>\n<li><p>Using an incorrect count of unpacked values in the <code class=\"docutils literal notranslate\">for</code> template tag\nraises an exception rather than failing silently.</p></li>\n<li><p>The ability to <a class=\"reference internal\" href=\"/en/dev/ref/urlresolvers/#django.urls.reverse\" title=\"django.urls.reverse\"><code class=\"xref py py-func docutils literal notranslate\">reverse()</code></a> URLs using a dotted Python path\nis removed.</p></li>\n<li><p>The ability to use a dotted Python path for the <code class=\"docutils literal notranslate\">LOGIN_URL</code> and\n<code class=\"docutils literal notranslate\">LOGIN_REDIRECT_URL</code> settings is removed.</p></li>\n<li><p>Support for <code class=\"docutils literal notranslate\">optparse</code> is dropped for custom management commands.</p></li>\n<li><p>The class <code class=\"docutils literal notranslate\">django.core.management.NoArgsCommand</code> is removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.context_processors</code> module is removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.sql.aggregates</code> module is removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.db.models.sql.aggregates</code> module is removed.</p></li>\n<li><p>The following methods and properties of <code class=\"docutils literal notranslate\">django.db.sql.query.Query</code> are\nremoved:</p>\n<ul>\n<li><p>Properties: <code class=\"docutils literal notranslate\">aggregates</code> and <code class=\"docutils literal notranslate\">aggregate_select</code></p></li>\n<li><p>Methods: <code class=\"docutils literal notranslate\">add_aggregate</code>, <code class=\"docutils literal notranslate\">set_aggregate_mask</code>, and\n<code class=\"docutils literal notranslate\">append_aggregate_mask</code>.</p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">django.template.resolve_variable</code> is removed.</p></li>\n<li><p>The following private APIs are removed from\n<a class=\"reference internal\" href=\"/en/dev/ref/models/meta/#django.db.models.options.Options\" title=\"django.db.models.options.Options\"><code class=\"xref py py-class docutils literal notranslate\">django.db.models.options.Options</code></a> (<code class=\"docutils literal notranslate\">Model._meta</code>):</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">get_field_by_name()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_field_names()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_fields_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_concrete_fields_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_m2m_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_objects()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_objects_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_many_to_many_objects()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_m2m_objects_with_model()</code></p></li>\n</ul>\n</li>\n<li><p>The <code class=\"docutils literal notranslate\">error_message</code> argument of <code class=\"docutils literal notranslate\">django.forms.RegexField</code> is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">unordered_list</code> filter no longer supports old style lists.</p></li>\n<li><p>Support for string <code class=\"docutils literal notranslate\">view</code> arguments to <code class=\"docutils literal notranslate\">url()</code> is removed.</p></li>\n<li><p>The backward compatible shim  to rename <code class=\"docutils literal notranslate\">django.forms.Form._has_changed()</code>\nto <code class=\"docutils literal notranslate\">has_changed()</code> is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">removetags</code> template filter is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">remove_tags()</code> and <code class=\"docutils literal notranslate\">strip_entities()</code> functions in\n<code class=\"docutils literal notranslate\">django.utils.html</code> is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">is_admin_site</code> argument to\n<code class=\"docutils literal notranslate\">django.contrib.auth.views.password_reset()</code> is removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.field.subclassing.SubfieldBase</code> is removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.checksums</code> is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">original_content_type_id</code> attribute on\n<code class=\"docutils literal notranslate\">django.contrib.admin.helpers.InlineAdminForm</code> is removed.</p></li>\n<li><p>The backwards compatibility shim to allow <code class=\"docutils literal notranslate\">FormMixin.get_form()</code> to be\ndefined with no default value for its <code class=\"docutils literal notranslate\">form_class</code> argument is removed.</p></li>\n<li><p>The following settings are removed, and you must upgrade to the\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-TEMPLATES\"><code class=\"xref std std-setting docutils literal notranslate\">TEMPLATES</code></a> setting:</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">ALLOWED_INCLUDE_ROOTS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_CONTEXT_PROCESSORS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_DEBUG</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_DIRS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_LOADERS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_STRING_IF_INVALID</code></p></li>\n</ul>\n</li>\n<li><p>The backwards compatibility alias <code class=\"docutils literal notranslate\">django.template.loader.BaseLoader</code> is\nremoved.</p></li>\n<li><p>Django template objects returned by\n<a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.loader.get_template\" title=\"django.template.loader.get_template\"><code class=\"xref py py-func docutils literal notranslate\">get_template()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.loader.select_template\" title=\"django.template.loader.select_template\"><code class=\"xref py py-func docutils literal notranslate\">select_template()</code></a> no longer accept a\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">Context</code></a> in their\n<a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.backends.base.Template.render\" title=\"django.template.backends.base.Template.render\"><code class=\"xref py py-meth docutils literal notranslate\">render()</code></a> method.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/template-response/\"><span class=\"doc\">Template response APIs</span></a> enforce the use of\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/stdtypes.html#dict\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">dict</code></a> and backend-dependent template objects instead of\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">Context</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Template\" title=\"django.template.Template\"><code class=\"xref py py-class docutils literal notranslate\">Template</code></a>\nrespectively.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">current_app</code> parameter for the following function and classes is\nremoved:</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.Context()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.RequestContext()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.response.TemplateResponse()</code></p></li>\n</ul>\n</li>\n<li><p>The <code class=\"docutils literal notranslate\">dictionary</code> and <code class=\"docutils literal notranslate\">context_instance</code> parameters for the following\nfunctions are removed:</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render_to_response()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader.render_to_string()</code></p></li>\n</ul>\n</li>\n<li><p>The <code class=\"docutils literal notranslate\">dirs</code> parameter for the following functions is removed:</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader.get_template()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader.select_template()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render_to_response()</code></p></li>\n</ul>\n</li>\n<li><p>Session verification is enabled regardless of whether or not\n<code class=\"docutils literal notranslate\">'django.contrib.auth.middleware.SessionAuthenticationMiddleware'</code> is in\n<code class=\"docutils literal notranslate\">MIDDLEWARE_CLASSES</code>. <code class=\"docutils literal notranslate\">SessionAuthenticationMiddleware</code> no longer has\nany purpose and can be removed from <code class=\"docutils literal notranslate\">MIDDLEWARE_CLASSES</code>. It’s kept as\na stub until Django 2.0 as a courtesy for users who don’t read this note.</p></li>\n<li><p>Private attribute <code class=\"docutils literal notranslate\">django.db.models.Field.related</code> is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">--list</code> option of the <code class=\"docutils literal notranslate\">migrate</code> management command is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">ssi</code> template tag is removed.</p></li>\n<li><p>Support for the <code class=\"docutils literal notranslate\">=</code> comparison operator in the <code class=\"docutils literal notranslate\">if</code> template tag is\nremoved.</p></li>\n<li><p>The backwards compatibility shims to allow <code class=\"docutils literal notranslate\">Storage.get_available_name()</code>\nand <code class=\"docutils literal notranslate\">Storage.save()</code> to be defined without a <code class=\"docutils literal notranslate\">max_length</code> argument are\nremoved.</p></li>\n<li><p>Support for the legacy <code class=\"docutils literal notranslate\">%(&lt;foo&gt;)s</code> syntax in <code class=\"docutils literal notranslate\">ModelFormMixin.success_url</code>\nis removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">GeoQuerySet</code> aggregate methods <code class=\"docutils literal notranslate\">collect()</code>, <code class=\"docutils literal notranslate\">extent()</code>, <code class=\"docutils literal notranslate\">extent3d()</code>,\n<code class=\"docutils literal notranslate\">make_line()</code>, and <code class=\"docutils literal notranslate\">unionagg()</code> are removed.</p></li>\n<li><p>The ability to specify <code class=\"docutils literal notranslate\">ContentType.name</code> when creating a content type\ninstance is removed.</p></li>\n<li><p>Support for the old signature of <code class=\"docutils literal notranslate\">allow_migrate</code> is removed.</p></li>\n<li><p>Support for the syntax of <code class=\"docutils literal notranslate\">{% cycle %}</code> that uses comma-separated arguments\nis removed.</p></li>\n<li><p>The warning that <a class=\"reference internal\" href=\"/en/dev/topics/signing/#django.core.signing.Signer\" title=\"django.core.signing.Signer\"><code class=\"xref py py-class docutils literal notranslate\">Signer</code></a> issued when given an\ninvalid separator is now a <code class=\"docutils literal notranslate\">ValueError</code>.</p></li>\n</ul>\n</section>","rootId":"django-1-10-release-notes","toc":[{"title":"Python compatibility","anchor":"python-compatibility","children":[]},{"title":"What’s new in Django 1.10","anchor":"what-s-new-in-django-1-10","children":[{"title":"Full text search for PostgreSQL","anchor":"full-text-search-for-postgresql","children":[]},{"title":"New-style middleware","anchor":"new-style-middleware","children":[]},{"title":"Official support for Unicode usernames","anchor":"official-support-for-unicode-usernames","children":[]},{"title":"Minor features","anchor":"minor-features","children":[{"title":"django.contrib.admin","anchor":"django-contrib-admin","children":[]},{"title":"django.contrib.auth","anchor":"django-contrib-auth","children":[]},{"title":"django.contrib.gis","anchor":"django-contrib-gis","children":[]},{"title":"django.contrib.postgres","anchor":"django-contrib-postgres","children":[]},{"title":"django.contrib.sessions","anchor":"django-contrib-sessions","children":[]},{"title":"django.contrib.sites","anchor":"django-contrib-sites","children":[]},{"title":"django.contrib.staticfiles","anchor":"django-contrib-staticfiles","children":[]},{"title":"Cache","anchor":"cache","children":[]},{"title":"CSRF","anchor":"csrf","children":[]},{"title":"Database backends","anchor":"database-backends","children":[]},{"title":"File Storage","anchor":"file-storage","children":[]},{"title":"Forms","anchor":"forms","children":[]},{"title":"Generic Views","anchor":"generic-views","children":[]},{"title":"Internationalization","anchor":"internationalization","children":[]},{"title":"Management Commands","anchor":"management-commands","children":[]},{"title":"Migrations","anchor":"migrations","children":[]},{"title":"Models","anchor":"models","children":[]},{"title":"Requests and Responses","anchor":"requests-and-responses","children":[]},{"title":"Serialization","anchor":"serialization","children":[]},{"title":"Templates","anchor":"templates","children":[]},{"title":"Tests","anchor":"tests","children":[]},{"title":"URLs","anchor":"urls","children":[]},{"title":"Validators","anchor":"validators","children":[]}]}]},{"title":"Backwards incompatible changes in 1.10","anchor":"backwards-incompatible-changes-in-1-10","children":[{"title":"Database backend API","anchor":"database-backend-api","children":[]},{"title":"select_related() prohibits non-relational fields for nested relations","anchor":"select-related-prohibits-non-relational-fields-for-nested-relations","children":[]},{"title":"_meta.get_fields() returns consistent reverse fields for proxy models","anchor":"meta-get-fields-returns-consistent-reverse-fields-for-proxy-models","children":[]},{"title":"AbstractUser.username max_length increased to 150","anchor":"abstractuser-username-max-length-increased-to-150","children":[]},{"title":"Dropped support for PostgreSQL 9.1","anchor":"dropped-support-for-postgresql-9-1","children":[]},{"title":"runserver output goes through logging","anchor":"runserver-output-goes-through-logging","children":[]},{"title":"auth.CustomUser and auth.ExtensionUser test models were removed","anchor":"auth-customuser-and-auth-extensionuser-test-models-were-removed","children":[]},{"title":"Apps registry is no longer auto-populated when unpickling models outside of Django","anchor":"apps-registry-is-no-longer-auto-populated-when-unpickling-models-outside-of-django","children":[]},{"title":"Removed null assignment check for non-null foreign key fields","anchor":"removed-null-assignment-check-for-non-null-foreign-key-fields","children":[]},{"title":"Removed weak password hashers from the default PASSWORD_HASHERS setting","anchor":"removed-weak-password-hashers-from-the-default-password-hashers-setting","children":[]},{"title":"Field.get_prep_lookup() and Field.get_db_prep_lookup() methods are removed","anchor":"field-get-prep-lookup-and-field-get-db-prep-lookup-methods-are-removed","children":[]},{"title":"django.contrib.gis","anchor":"id1","children":[]},{"title":"Maximum size of a request body and the number of GET/POST parameters is limited","anchor":"maximum-size-of-a-request-body-and-the-number-of-get-post-parameters-is-limited","children":[]},{"title":"Miscellaneous","anchor":"miscellaneous","children":[]}]},{"title":"Features deprecated in 1.10","anchor":"features-deprecated-in-1-10","children":[{"title":"Direct assignment to a reverse foreign key or many-to-many relation","anchor":"direct-assignment-to-a-reverse-foreign-key-or-many-to-many-relation","children":[]},{"title":"Non-timezone-aware Storage API","anchor":"non-timezone-aware-storage-api","children":[]},{"title":"django.contrib.gis","anchor":"id2","children":[]},{"title":"CommaSeparatedIntegerField model field","anchor":"commaseparatedintegerfield-model-field","children":[]},{"title":"Using a model name as a query lookup when default_related_name is set","anchor":"using-a-model-name-as-a-query-lookup-when-default-related-name-is-set","children":[]},{"title":"__search query lookup","anchor":"search-query-lookup","children":[]},{"title":"Using User.is_authenticated() and User.is_anonymous() as methods","anchor":"using-user-is-authenticated-and-user-is-anonymous-as-methods","children":[]},{"title":"Custom manager classes available through prefetch_related must define a _apply_rel_filters() method","anchor":"custom-manager-classes-available-through-prefetch-related-must-define-a-apply-rel-filters-method","children":[]},{"title":"The “escape” half of django.utils.safestring","anchor":"the-escape-half-of-django-utils-safestring","children":[]},{"title":"Manager.use_for_related_fields and inheritance changes","anchor":"manager-use-for-related-fields-and-inheritance-changes","children":[]},{"title":"Miscellaneous","anchor":"id3","children":[]}]},{"title":"Features removed in 1.10","anchor":"features-removed-in-1-10","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.10.1","title":"Django 1.10.1 release notes","url":"/en/dev/releases/1.10.1/"},"next":{"docname":"releases/1.9.13","title":"Django 1.9.13 release notes","url":"/en/dev/releases/1.9.13/"},"formats":{"html":"/en/dev/releases/1.10/","markdown":"/en/dev/releases/1.10.md","json":"/en/dev/releases/1.10.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.10.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.10/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10"],"inLocales":["en"]}