{"title":"Django 1.11 release notes","version":"dev","locale":"en","docname":"releases/1.11","url":"/en/dev/releases/1.11/","canonical":"https://djangodocs.dev/en/dev/releases/1.11/","summary":"Welcome to Django 1.11! 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.11 release notes<a class=\"heading-anchor\" href=\"#django-1-11-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>April 4, 2017</em></p>\n<p>Welcome to Django 1.11!</p>\n<p>These release notes cover the <a class=\"reference internal\" href=\"#whats-new-1-11\"><span class=\"std std-ref\">new features</span></a>, as well as\nsome <a class=\"reference internal\" href=\"#backwards-incompatible-1-11\"><span class=\"std std-ref\">backwards incompatible changes</span></a> you’ll\nwant to be aware of when upgrading from Django 1.10 or older versions. We’ve\n<a class=\"reference internal\" href=\"#deprecated-features-1-11\"><span class=\"std std-ref\">begun the deprecation process for some 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<p>Django 1.11 is designated as a <a class=\"reference internal\" href=\"/en/dev/internals/release-process/#term-Long-term-support-release\"><span class=\"xref std std-term\">long-term support release</span></a>. It will receive security updates for at least\nthree years after its release. Support for the previous LTS, Django 1.8, will\nend in April 2018.</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>Django 1.11 requires Python 2.7, 3.4, 3.5, 3.6, or 3.7 (as of 1.11.17). We\n<strong>highly recommend</strong> and only officially support the latest release of each\nseries.</p>\n<p>The Django 1.11.x series is the last to support Python 2. The next major\nrelease, Django 2.0, will only support Python 3.4+.</p>\n</section>\n<section id=\"deprecating-warnings-are-no-longer-loud-by-default\">\n<h2>Deprecating warnings are no longer loud by default<a class=\"heading-anchor\" href=\"#deprecating-warnings-are-no-longer-loud-by-default\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Unlike older versions of Django, Django’s own deprecation warnings are no\nlonger displayed by default. This is consistent with Python’s default behavior.</p>\n<p>This change allows third-party apps to support both Django 1.11 LTS and Django\n1.8 LTS without having to add code to avoid deprecation warnings.</p>\n<p>Following the release of Django 2.0, we suggest that third-party app authors\ndrop support for all versions of Django prior to 1.11. At that time, you should\nbe able run your package’s tests using <code class=\"docutils literal notranslate\">python -Wd</code> so that deprecation\nwarnings do appear. After making the deprecation warning fixes, your app should\nbe compatible with Django 2.0.</p>\n</section>\n<section id=\"what-s-new-in-django-1-11\">\n<span id=\"whats-new-1-11\"></span><h2>What’s new in Django 1.11<a class=\"heading-anchor\" href=\"#what-s-new-in-django-1-11\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"class-based-model-indexes\">\n<h3>Class-based model indexes<a class=\"heading-anchor\" href=\"#class-based-model-indexes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The new <a class=\"reference internal\" href=\"/en/dev/ref/models/indexes/#module-django.db.models.indexes\" title=\"django.db.models.indexes\"><code class=\"xref py py-mod docutils literal notranslate\">django.db.models.indexes</code></a> module contains classes which ease\ncreating database indexes. Indexes are added to models using the\n<a class=\"reference internal\" href=\"/en/dev/ref/models/options/#django.db.models.Options.indexes\" title=\"django.db.models.Options.indexes\"><code class=\"xref py py-attr docutils literal notranslate\">Meta.indexes</code></a> option.</p>\n<p>The <a class=\"reference internal\" href=\"/en/dev/ref/models/indexes/#django.db.models.Index\" title=\"django.db.models.Index\"><code class=\"xref py py-class docutils literal notranslate\">Index</code></a> class creates a b-tree index, as if you\nused <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.Field.db_index\" title=\"django.db.models.Field.db_index\"><code class=\"xref py py-attr docutils literal notranslate\">db_index</code></a> on the model field or\n<code class=\"docutils literal notranslate\">index_together</code> on the model <code class=\"docutils literal notranslate\">Meta</code> class. It can be subclassed to support\ndifferent index types, such as\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/indexes/#django.contrib.postgres.indexes.GinIndex\" title=\"django.contrib.postgres.indexes.GinIndex\"><code class=\"xref py py-class docutils literal notranslate\">GinIndex</code></a>. It also allows defining the\norder (ASC/DESC) for the columns of the index.</p>\n</section>\n<section id=\"template-based-widget-rendering\">\n<h3>Template-based widget rendering<a class=\"heading-anchor\" href=\"#template-based-widget-rendering\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>To ease customizing widgets, form widget rendering is now done using the\ntemplate system rather than in Python. See <a class=\"reference internal\" href=\"/en/dev/ref/forms/renderers/\"><span class=\"doc\">The form rendering API</span></a>.</p>\n<p>You may need to adjust any custom widgets that you’ve written for a few\n<a class=\"reference internal\" href=\"#template-widget-incompatibilities-1-11\"><span class=\"std std-ref\">backwards incompatible changes</span></a>.</p>\n</section>\n<section id=\"subquery-expressions\">\n<h3><code class=\"docutils literal notranslate\">Subquery</code> expressions<a class=\"heading-anchor\" href=\"#subquery-expressions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The new <a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.Subquery\" title=\"django.db.models.Subquery\"><code class=\"xref py py-class docutils literal notranslate\">Subquery</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.Exists\" title=\"django.db.models.Exists\"><code class=\"xref py py-class docutils literal notranslate\">Exists</code></a> database expressions allow creating\nexplicit subqueries. Subqueries may refer to fields from the outer queryset\nusing the <a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.OuterRef\" title=\"django.db.models.OuterRef\"><code class=\"xref py py-class docutils literal notranslate\">OuterRef</code></a> class.</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><a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.date_hierarchy\" title=\"django.contrib.admin.ModelAdmin.date_hierarchy\"><code class=\"xref py py-attr docutils literal notranslate\">ModelAdmin.date_hierarchy</code></a> can now reference fields across relations.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_exclude\" title=\"django.contrib.admin.ModelAdmin.get_exclude\"><code class=\"xref py py-meth docutils literal notranslate\">ModelAdmin.get_exclude()</code></a> hook allows specifying the\nexclude fields based on the request or model instance.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">popup_response.html</code> template can now be overridden per app, per\nmodel, or by setting the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.popup_response_template\" title=\"django.contrib.admin.ModelAdmin.popup_response_template\"><code class=\"xref py py-attr docutils literal notranslate\">ModelAdmin.popup_response_template</code></a>\nattribute.</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>The default iteration count for the PBKDF2 password hasher is increased by\n20%.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.LoginView\" title=\"django.contrib.auth.views.LoginView\"><code class=\"xref py py-class docutils literal notranslate\">LoginView</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.LogoutView\" title=\"django.contrib.auth.views.LogoutView\"><code class=\"xref py py-class docutils literal notranslate\">LogoutView</code></a> class-based views supersede\nthe deprecated <code class=\"docutils literal notranslate\">login()</code> and <code class=\"docutils literal notranslate\">logout()</code> function-based views.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordChangeView\" title=\"django.contrib.auth.views.PasswordChangeView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordChangeView</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordChangeDoneView\" title=\"django.contrib.auth.views.PasswordChangeDoneView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordChangeDoneView</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetView\" title=\"django.contrib.auth.views.PasswordResetView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetView</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetDoneView\" title=\"django.contrib.auth.views.PasswordResetDoneView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetDoneView</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetConfirmView\" title=\"django.contrib.auth.views.PasswordResetConfirmView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetConfirmView</code></a>, and\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetCompleteView\" title=\"django.contrib.auth.views.PasswordResetCompleteView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetCompleteView</code></a> class-based\nviews supersede the deprecated <code class=\"docutils literal notranslate\">password_change()</code>,\n<code class=\"docutils literal notranslate\">password_change_done()</code>, <code class=\"docutils literal notranslate\">password_reset()</code>, <code class=\"docutils literal notranslate\">password_reset_done()</code>,\n<code class=\"docutils literal notranslate\">password_reset_confirm()</code>, and <code class=\"docutils literal notranslate\">password_reset_complete()</code>\nfunction-based views.</p></li>\n<li><p>The new <code class=\"docutils literal notranslate\">post_reset_login</code> attribute for\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetConfirmView\" title=\"django.contrib.auth.views.PasswordResetConfirmView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetConfirmView</code></a> allows\nautomatically logging in a user after a successful password reset.\nIf you have multiple <code class=\"docutils literal notranslate\">AUTHENTICATION_BACKENDS</code> configured, use the\n<code class=\"docutils literal notranslate\">post_reset_login_backend</code> attribute to choose which one to use.</p></li>\n<li><p>To avoid the possibility of leaking a password reset token via the HTTP\nReferer header (for example, if the reset page includes a reference to CSS or\nJavaScript hosted on another domain), the\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetConfirmView\" title=\"django.contrib.auth.views.PasswordResetConfirmView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetConfirmView</code></a> (but not the\ndeprecated <code class=\"docutils literal notranslate\">password_reset_confirm()</code> function-based view) stores the token\nin a session and redirects to itself to present the password change form to\nthe user without the token in the URL.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.update_session_auth_hash\" title=\"django.contrib.auth.update_session_auth_hash\"><code class=\"xref py py-func docutils literal notranslate\">update_session_auth_hash()</code></a> now rotates the session\nkey to allow a password change to invalidate stolen session cookies.</p></li>\n<li><p>The new <code class=\"docutils literal notranslate\">success_url_allowed_hosts</code> attribute for\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.LoginView\" title=\"django.contrib.auth.views.LoginView\"><code class=\"xref py py-class docutils literal notranslate\">LoginView</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.LogoutView\" title=\"django.contrib.auth.views.LogoutView\"><code class=\"xref py py-class docutils literal notranslate\">LogoutView</code></a> allows specifying a set of\nhosts that are safe for redirecting after login and logout.</p></li>\n<li><p>Added password validators <code class=\"docutils literal notranslate\">help_text</code> to\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.forms.UserCreationForm\" title=\"django.contrib.auth.forms.UserCreationForm\"><code class=\"xref py py-class docutils literal notranslate\">UserCreationForm</code></a>.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">HttpRequest</code> is now passed to\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.authenticate\" title=\"django.contrib.auth.authenticate\"><code class=\"xref py py-func docutils literal notranslate\">authenticate()</code></a> which in turn passes it to the\nauthentication backend if it accepts a <code class=\"docutils literal notranslate\">request</code> argument.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.signals.user_login_failed\" title=\"django.contrib.auth.signals.user_login_failed\"><code class=\"xref py py-func docutils literal notranslate\">user_login_failed()</code></a> signal now\nreceives a <code class=\"docutils literal notranslate\">request</code> argument.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.forms.PasswordResetForm\" title=\"django.contrib.auth.forms.PasswordResetForm\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetForm</code></a> supports custom user\nmodels that use an email field named something other than <code class=\"docutils literal notranslate\">'email'</code>. Set\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.models.CustomUser.EMAIL_FIELD\" title=\"django.contrib.auth.models.CustomUser.EMAIL_FIELD\"><code class=\"xref py py-attr docutils literal notranslate\">CustomUser.EMAIL_FIELD</code></a> to the name of the\nfield.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.get_user_model\" title=\"django.contrib.auth.get_user_model\"><code class=\"xref py py-func docutils literal notranslate\">get_user_model()</code></a> can now be called at import time,\neven in modules that define models.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-contenttypes\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/contenttypes/#module-django.contrib.contenttypes\" title=\"django.contrib.contenttypes: Provides generic interface to installed models.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.contenttypes</code></a><a class=\"heading-anchor\" href=\"#django-contrib-contenttypes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>When stale content types are detected in the\n<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-remove_stale_contenttypes\"><code class=\"xref std std-djadmin docutils literal notranslate\">remove_stale_contenttypes</code></a> command, there’s now a list of related\nobjects such as <code class=\"docutils literal notranslate\">auth.Permission</code>s that will also be deleted. Previously,\nonly the content types were listed (and this prompt was after <code class=\"docutils literal notranslate\">migrate</code>\nrather than in a separate command).</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>The new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.from_gml\" title=\"django.contrib.gis.geos.GEOSGeometry.from_gml\"><code class=\"xref py py-meth docutils literal notranslate\">GEOSGeometry.from_gml()</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/gdal/#django.contrib.gis.gdal.OGRGeometry.from_gml\" title=\"django.contrib.gis.gdal.OGRGeometry.from_gml\"><code class=\"xref py py-meth docutils literal notranslate\">OGRGeometry.from_gml()</code></a>\nmethods allow creating geometries from GML.</p></li>\n<li><p>Added support for the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geoquerysets/#std-fieldlookup-dwithin\"><code class=\"xref std std-lookup docutils literal notranslate\">dwithin</code></a> lookup on SpatiaLite.</p></li>\n<li><p>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> function,\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.Distance\" title=\"django.contrib.gis.db.models.functions.Distance\"><code class=\"xref py py-class docutils literal notranslate\">Distance</code></a> function, and\ndistance lookups now work with geodetic coordinates on SpatiaLite.</p></li>\n<li><p>The OpenLayers-based form widgets now use <code class=\"docutils literal notranslate\">OpenLayers.js</code> from\n<code class=\"docutils literal notranslate\">https://cdnjs.cloudflare.com</code> which is more suitable for production use\nthan the old <code class=\"docutils literal notranslate\">https://openlayers.org/</code> source. They are also updated to use\nOpenLayers 3.</p></li>\n<li><p>PostGIS migrations can now change field dimensions.</p></li>\n<li><p>Added the ability to pass the <code class=\"docutils literal notranslate\">size</code>, <code class=\"docutils literal notranslate\">shape</code>, and <code class=\"docutils literal notranslate\">offset</code> parameters\nwhen creating <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/gdal/#django.contrib.gis.gdal.GDALRaster\" title=\"django.contrib.gis.gdal.GDALRaster\"><code class=\"xref py py-class docutils literal notranslate\">GDALRaster</code></a> objects.</p></li>\n<li><p>Added SpatiaLite support for the\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> function,\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> function, and\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.</p></li>\n<li><p>Added Oracle support for the\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.AsGML\" title=\"django.contrib.gis.db.models.functions.AsGML\"><code class=\"xref py py-class docutils literal notranslate\">AsGML</code></a> function,\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/functions/#django.contrib.gis.db.models.functions.BoundingCircle\" title=\"django.contrib.gis.db.models.functions.BoundingCircle\"><code class=\"xref py py-class docutils literal notranslate\">BoundingCircle</code></a> function,\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> function, and\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.</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>The new <code class=\"docutils literal notranslate\">distinct</code> argument for\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/aggregates/#django.contrib.postgres.aggregates.StringAgg\" title=\"django.contrib.postgres.aggregates.StringAgg\"><code class=\"xref py py-class docutils literal notranslate\">StringAgg</code></a> determines if\nconcatenated values will be distinct.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/indexes/#django.contrib.postgres.indexes.GinIndex\" title=\"django.contrib.postgres.indexes.GinIndex\"><code class=\"xref py py-class docutils literal notranslate\">GinIndex</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/indexes/#django.contrib.postgres.indexes.BrinIndex\" title=\"django.contrib.postgres.indexes.BrinIndex\"><code class=\"xref py py-class docutils literal notranslate\">BrinIndex</code></a> classes allow\ncreating <code class=\"docutils literal notranslate\">GIN</code> and <code class=\"docutils literal notranslate\">BRIN</code> indexes in the database.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.postgres.fields.JSONField</code> accepts a new <code class=\"docutils literal notranslate\">encoder</code>\nparameter to specify a custom class to encode data types not supported by the\nstandard encoder.</p></li>\n<li><p>The new <code class=\"docutils literal notranslate\">CIText</code> mixin and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/operations/#django.contrib.postgres.operations.CITextExtension\" title=\"django.contrib.postgres.operations.CITextExtension\"><code class=\"xref py py-class docutils literal notranslate\">CITextExtension</code></a> migration\noperation allow using PostgreSQL’s <code class=\"docutils literal notranslate\">citext</code> extension for case-insensitive\nlookups. Three fields are provided: <code class=\"docutils literal notranslate\">CICharField</code>, <code class=\"docutils literal notranslate\">CIEmailField</code>, and\n<code class=\"docutils literal notranslate\">CITextField</code>.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/aggregates/#django.contrib.postgres.aggregates.JSONBAgg\" title=\"django.contrib.postgres.aggregates.JSONBAgg\"><code class=\"xref py py-class docutils literal notranslate\">JSONBAgg</code></a> allows\naggregating values as a JSON array.</p></li>\n<li><p>The <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> (model field) and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/forms/#django.contrib.postgres.forms.HStoreField\" title=\"django.contrib.postgres.forms.HStoreField\"><code class=\"xref py py-class docutils literal notranslate\">HStoreField</code></a> (form field) allow\nstoring null values.</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>Memcached backends now pass the contents of\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-CACHES-OPTIONS\"><code class=\"xref std std-setting docutils literal notranslate\">OPTIONS</code></a> as keyword arguments to the client\nconstructors, allowing for more advanced control of client behavior. See the\n<a class=\"reference internal\" href=\"/en/dev/topics/cache/#cache-arguments\"><span class=\"std std-ref\">cache arguments</span></a> documentation for examples.</p></li>\n<li><p>Memcached backends now allow defining multiple servers as a comma-delimited\nstring in <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-CACHES-LOCATION\"><code class=\"xref std std-setting docutils literal notranslate\">LOCATION</code></a>, for convenience with\nthird-party services that use such strings in environment variables.</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>Added the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-CSRF_USE_SESSIONS\"><code class=\"xref std std-setting docutils literal notranslate\">CSRF_USE_SESSIONS</code></a> setting to allow storing the CSRF\ntoken in the user’s session rather than in a cookie.</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>Added the <code class=\"docutils literal notranslate\">skip_locked</code> argument to <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_for_update\" title=\"django.db.models.query.QuerySet.select_for_update\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.select_for_update()</code></a>\non PostgreSQL 9.5+ and Oracle to execute queries with\n<code class=\"docutils literal notranslate\">FOR UPDATE SKIP LOCKED</code>.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-TEST_TEMPLATE\"><code class=\"xref std std-setting docutils literal notranslate\">TEST['TEMPLATE']</code></a> setting to let\nPostgreSQL users specify a template for creating the test database.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.iterator\" title=\"django.db.models.query.QuerySet.iterator\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.iterator()</code></a> now uses <a class=\"reference external\" href=\"https://www.psycopg.org/docs/usage.html#server-side-cursors\">server-side cursors</a> on PostgreSQL.\nThis feature transfers some of the worker memory load (used to hold query\nresults) to the database and might increase database memory usage.</p>\n</li>\n<li><p>Added MySQL support for the <code class=\"docutils literal notranslate\">'isolation_level'</code> option in\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-OPTIONS\"><code class=\"xref std std-setting docutils literal notranslate\">OPTIONS</code></a> to allow specifying the <a class=\"reference internal\" href=\"/en/dev/ref/databases/#mysql-isolation-level\"><span class=\"std std-ref\">transaction isolation level</span></a>. To avoid possible data loss, it’s recommended to\nswitch from MySQL’s default level, repeatable read, to read committed.</p></li>\n<li><p>Added support for <code class=\"docutils literal notranslate\">cx_Oracle</code> 5.3.</p></li>\n</ul>\n</section>\n<section id=\"email\">\n<h4>Email<a class=\"heading-anchor\" href=\"#email\"><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 <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-EMAIL_USE_LOCALTIME\"><code class=\"xref std std-setting docutils literal notranslate\">EMAIL_USE_LOCALTIME</code></a> setting to allow sending SMTP date\nheaders in the local time zone rather than in UTC.</p></li>\n<li><p><code class=\"docutils literal notranslate\">EmailMessage.attach()</code> and <code class=\"docutils literal notranslate\">attach_file()</code> now fall back to MIME type\n<em class=\"mimetype\">application/octet-stream</em> when binary content that can’t be\ndecoded as UTF-8 is specified for a <em class=\"mimetype\">text/*</em> attachment.</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>To make it wrappable by <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>,\n<a class=\"reference internal\" href=\"/en/dev/ref/files/file/#django.core.files.File\" title=\"django.core.files.File\"><code class=\"xref py py-class docutils literal notranslate\">File</code></a> now has the <code class=\"docutils literal notranslate\">readable()</code>, <code class=\"docutils literal notranslate\">writable()</code>,\nand <code class=\"docutils literal notranslate\">seekable()</code> methods.</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>The new <code class=\"docutils literal notranslate\">empty_value</code> attribute on <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>,\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.EmailField\" title=\"django.forms.EmailField\"><code class=\"xref py py-class docutils literal notranslate\">EmailField</code></a>, <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.RegexField\" title=\"django.forms.RegexField\"><code class=\"xref py py-class docutils literal notranslate\">RegexField</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.SlugField\" title=\"django.forms.SlugField\"><code class=\"xref py py-class docutils literal notranslate\">SlugField</code></a>, and <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.URLField\" title=\"django.forms.URLField\"><code class=\"xref py py-class docutils literal notranslate\">URLField</code></a> allows\nspecifying the Python value to use to represent “empty”.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.get_initial_for_field\" title=\"django.forms.Form.get_initial_for_field\"><code class=\"xref py py-meth docutils literal notranslate\">Form.get_initial_for_field()</code></a> method returns initial data for a\nform field.</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>Number formatting and the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-NUMBER_GROUPING\"><code class=\"xref std std-setting docutils literal notranslate\">NUMBER_GROUPING</code></a> setting support\nnon-uniform digit grouping.</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>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-loaddata-exclude\"><code class=\"xref std std-option docutils literal notranslate\">loaddata --exclude</code></a> option allows excluding models and apps\nwhile loading data from fixtures.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-diffsettings-default\"><code class=\"xref std std-option docutils literal notranslate\">diffsettings --default</code></a> option allows specifying a settings\nmodule other than Django’s default settings to compare against.</p></li>\n<li><p><code class=\"docutils literal notranslate\">app_label</code>s arguments now limit the <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-showmigrations-plan\"><code class=\"xref std std-option docutils literal notranslate\">showmigrations --plan</code></a>\noutput.</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\">uuid.UUID</code> objects.</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>Added support for callable values in the <code class=\"docutils literal notranslate\">defaults</code> argument of\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.update_or_create\" title=\"django.db.models.query.QuerySet.update_or_create\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.update_or_create()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.get_or_create\" title=\"django.db.models.query.QuerySet.get_or_create\"><code class=\"xref py py-meth docutils literal notranslate\">get_or_create()</code></a>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ImageField\" title=\"django.db.models.ImageField\"><code class=\"xref py py-class docutils literal notranslate\">ImageField</code></a> now has a default\n<a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.validate_image_file_extension\" title=\"django.core.validators.validate_image_file_extension\"><code class=\"xref py py-data docutils literal notranslate\">validate_image_file_extension</code></a> validator.\n(This validator moved to the form field in <a class=\"reference internal\" href=\"/en/dev/releases/1.11.2/\"><span class=\"doc\">Django 1.11.2</span></a>.)</p></li>\n<li><p>Added support for time truncation to\n<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.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.ExtractWeek\" title=\"django.db.models.functions.ExtractWeek\"><code class=\"xref py py-class docutils literal notranslate\">ExtractWeek</code></a> function to\nextract the week from <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.DateField\" title=\"django.db.models.DateField\"><code class=\"xref py py-class docutils literal notranslate\">DateField</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.DateTimeField\" title=\"django.db.models.DateTimeField\"><code class=\"xref py py-class docutils literal notranslate\">DateTimeField</code></a> and exposed it through the\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#std-fieldlookup-week\"><code class=\"xref std std-lookup docutils literal notranslate\">week</code></a> lookup.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.TruncTime\" title=\"django.db.models.functions.TruncTime\"><code class=\"xref py py-class docutils literal notranslate\">TruncTime</code></a> function to truncate\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.DateTimeField\" title=\"django.db.models.DateTimeField\"><code class=\"xref py py-class docutils literal notranslate\">DateTimeField</code></a> to its time component and exposed it\nthrough the <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#std-fieldlookup-time\"><code class=\"xref std std-lookup docutils literal notranslate\">time</code></a> lookup.</p></li>\n<li><p>Added support for expressions in <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.values\" title=\"django.db.models.query.QuerySet.values\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.values()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.values_list\" title=\"django.db.models.query.QuerySet.values_list\"><code class=\"xref py py-meth docutils literal notranslate\">values_list()</code></a>.</p></li>\n<li><p>Added support for query expressions on lookups that take multiple arguments,\nsuch as <code class=\"docutils literal notranslate\">range</code>.</p></li>\n<li><p>You can now use the <code class=\"docutils literal notranslate\">unique=True</code> option with\n<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<li><p>Added the <code class=\"docutils literal notranslate\">nulls_first</code> and <code class=\"docutils literal notranslate\">nulls_last</code> parameters to\n<a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.Expression.asc\" title=\"django.db.models.Expression.asc\"><code class=\"xref py py-class docutils literal notranslate\">Expression.asc()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.Expression.desc\" title=\"django.db.models.Expression.desc\"><code class=\"xref py py-meth docutils literal notranslate\">desc()</code></a> to control\nthe ordering of null values.</p></li>\n<li><p>The new <code class=\"docutils literal notranslate\">F</code> expression <code class=\"docutils literal notranslate\">bitleftshift()</code> and <code class=\"docutils literal notranslate\">bitrightshift()</code> methods\nallow <a class=\"reference internal\" href=\"/en/dev/topics/db/queries/#using-f-expressions-in-filters\"><span class=\"std std-ref\">bitwise shift operations</span></a>.</p></li>\n<li><p>Added <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.union\" title=\"django.db.models.query.QuerySet.union\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.union()</code></a>, <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.intersection\" title=\"django.db.models.query.QuerySet.intersection\"><code class=\"xref py py-meth docutils literal notranslate\">intersection()</code></a>, and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.difference\" title=\"django.db.models.query.QuerySet.difference\"><code class=\"xref py py-meth docutils literal notranslate\">difference()</code></a>.</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 <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.QueryDict.fromkeys\" title=\"django.http.QueryDict.fromkeys\"><code class=\"xref py py-meth docutils literal notranslate\">QueryDict.fromkeys()</code></a>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.common.CommonMiddleware\" title=\"django.middleware.common.CommonMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">CommonMiddleware</code></a> now sets the\n<code class=\"docutils literal notranslate\">Content-Length</code> response header for non-streaming responses.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-SECURE_HSTS_PRELOAD\"><code class=\"xref std std-setting docutils literal notranslate\">SECURE_HSTS_PRELOAD</code></a> setting to allow appending the\n<code class=\"docutils literal notranslate\">preload</code> directive to the <code class=\"docutils literal notranslate\">Strict-Transport-Security</code> header.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.http.ConditionalGetMiddleware\" title=\"django.middleware.http.ConditionalGetMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">ConditionalGetMiddleware</code></a> now adds the\n<code class=\"docutils literal notranslate\">ETag</code> header to responses.</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 new <code class=\"docutils literal notranslate\">django.core.serializers.base.Serializer.stream_class</code> attribute\nallows subclasses to customize the default stream.</p></li>\n<li><p>The encoder used by the <a class=\"reference internal\" href=\"/en/dev/topics/serialization/#serialization-formats-json\"><span class=\"std std-ref\">JSON serializer</span></a>\ncan now be customized by passing a <code class=\"docutils literal notranslate\">cls</code> keyword argument to the\n<code class=\"docutils literal notranslate\">serializers.serialize()</code> function.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/serialization/#django.core.serializers.json.DjangoJSONEncoder\" title=\"django.core.serializers.json.DjangoJSONEncoder\"><code class=\"xref py py-class docutils literal notranslate\">DjangoJSONEncoder</code></a> now serializes\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#datetime.timedelta\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">timedelta</code></a> objects (used by\n<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=\"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><a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.safestring.mark_safe\" title=\"django.utils.safestring.mark_safe\"><code class=\"xref py py-meth docutils literal notranslate\">mark_safe()</code></a> can now be used as a decorator.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.backends.jinja2.Jinja2\" title=\"django.template.backends.jinja2.Jinja2\"><code class=\"xref py py-class docutils literal notranslate\">Jinja2</code></a> template backend now\nsupports context processors by setting the <code class=\"docutils literal notranslate\">'context_processors'</code> option in\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-TEMPLATES-OPTIONS\"><code class=\"xref std std-setting docutils literal notranslate\">OPTIONS</code></a>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-regroup\"><code class=\"xref std std-ttag docutils literal notranslate\">regroup</code></a> tag now returns <code class=\"docutils literal notranslate\">namedtuple</code>s instead of dictionaries\nso you can unpack the group object directly in a loop, e.g.\n<code class=\"docutils literal notranslate\">{% for grouper, list in regrouped %}</code>.</p></li>\n<li><p>Added a <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-resetcycle\"><code class=\"xref std std-ttag docutils literal notranslate\">resetcycle</code></a> template tag to allow resetting the sequence of\nthe <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-cycle\"><code class=\"xref std std-ttag docutils literal notranslate\">cycle</code></a> template tag.</p></li>\n<li><p>You can now specify specific directories for a particular\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.loaders.filesystem.Loader\" title=\"django.template.loaders.filesystem.Loader\"><code class=\"xref py py-class docutils literal notranslate\">filesystem.Loader</code></a>.</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>Added <a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.runner.DiscoverRunner.get_test_runner_kwargs\" title=\"django.test.runner.DiscoverRunner.get_test_runner_kwargs\"><code class=\"xref py py-meth docutils literal notranslate\">DiscoverRunner.get_test_runner_kwargs()</code></a> to allow customizing the\nkeyword arguments passed to the test runner.</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-test-debug-mode\"><code class=\"xref std std-option docutils literal notranslate\">test --debug-mode</code></a> option to help troubleshoot test\nfailures by setting the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\">DEBUG</code></a> setting to <code class=\"docutils literal notranslate\">True</code>.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.utils.setup_databases\" title=\"django.test.utils.setup_databases\"><code class=\"xref py py-func docutils literal notranslate\">django.test.utils.setup_databases()</code></a> (moved from\n<code class=\"docutils literal notranslate\">django.test.runner</code>) and <a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.utils.teardown_databases\" title=\"django.test.utils.teardown_databases\"><code class=\"xref py py-func docutils literal notranslate\">teardown_databases()</code></a>\nfunctions make it easier to build custom test runners.</p></li>\n<li><p>Added support for <a class=\"reference external\" href=\"https://docs.python.org/3/library/unittest.html#unittest.TestCase.subTest\" title=\"(in Python v3.14)\"><code class=\"docutils literal notranslate\">unittest.TestCase.subTest()</code></a>’s when using the\n<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-test-parallel\"><code class=\"xref std std-option docutils literal notranslate\">test --parallel</code></a> option.</p></li>\n<li><p><code class=\"docutils literal notranslate\">DiscoverRunner</code> now runs the system checks at the start of a test run.\nOverride the <a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.runner.DiscoverRunner.run_checks\" title=\"django.test.runner.DiscoverRunner.run_checks\"><code class=\"xref py py-meth docutils literal notranslate\">DiscoverRunner.run_checks()</code></a> method if you want to disable\nthat.</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>Added <a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.FileExtensionValidator\" title=\"django.core.validators.FileExtensionValidator\"><code class=\"xref py py-class docutils literal notranslate\">FileExtensionValidator</code></a> to validate\nfile extensions and\n<a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.validate_image_file_extension\" title=\"django.core.validators.validate_image_file_extension\"><code class=\"xref py py-data docutils literal notranslate\">validate_image_file_extension</code></a> to validate\nimage files.</p></li>\n</ul>\n</section>\n</section>\n</section>\n<section id=\"backwards-incompatible-changes-in-1-11\">\n<span id=\"backwards-incompatible-1-11\"></span><h2>Backwards incompatible changes in 1.11<a class=\"heading-anchor\" href=\"#backwards-incompatible-changes-in-1-11\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\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>To simplify the codebase and because it’s easier to install than when\n<code class=\"docutils literal notranslate\">contrib.gis</code> was first released, <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/install/geolibs/#gdalbuild\"><span class=\"std std-ref\">GDAL</span></a> is now a required\ndependency for GeoDjango. In older versions, it’s only required for SQLite.</p></li>\n<li><p><code class=\"docutils literal notranslate\">contrib.gis.maps</code> is removed as it interfaces with a retired version of\nthe Google Maps API and seems to be unmaintained. If you’re using it,\n<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/14284\">let us know</a>.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">GEOSGeometry</code> equality operator now also compares SRID.</p></li>\n<li><p>The OpenLayers-based form widgets now use OpenLayers 3, and the\n<code class=\"docutils literal notranslate\">gis/openlayers.html</code> and <code class=\"docutils literal notranslate\">gis/openlayers-osm.html</code> templates have been\nupdated. Check your project if you subclass these widgets or extend the\ntemplates. Also, the new widgets work a bit differently than the old ones.\nInstead of using a toolbar in the widget, you click to draw, click and drag\nto move the map, and click and drag a point/vertex/corner to move it.</p></li>\n<li><p>Support for SpatiaLite &lt; 4.0 is dropped.</p></li>\n<li><p>Support for GDAL 1.7 and 1.8 is dropped.</p></li>\n<li><p>The widgets in <code class=\"docutils literal notranslate\">contrib.gis.forms.widgets</code> and the admin’s\n<code class=\"docutils literal notranslate\">OpenLayersWidget</code> use the <a class=\"reference internal\" href=\"/en/dev/ref/forms/renderers/\"><span class=\"doc\">form rendering API</span></a>\nrather than <code class=\"docutils literal notranslate\">loader.render_to_string()</code>. If you’re using a custom widget\ntemplate, you’ll need to be sure your form renderer can locate it. For\nexample, you could use the <a class=\"reference internal\" href=\"/en/dev/ref/forms/renderers/#django.forms.renderers.TemplatesSetting\" title=\"django.forms.renderers.TemplatesSetting\"><code class=\"xref py py-class docutils literal notranslate\">TemplatesSetting</code></a>\nrenderer.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-staticfiles\">\n<h3><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></h3>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">collectstatic</code> may now fail during post-processing when using a hashed\nstatic files storage if a reference loop exists (e.g. <code class=\"docutils literal notranslate\">'foo.css'</code>\nreferences <code class=\"docutils literal notranslate\">'bar.css'</code> which itself references <code class=\"docutils literal notranslate\">'foo.css'</code>) or if the\nchain of files referencing other files is too deep to resolve in several\npasses. In the latter case, increase the number of passes using\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage.max_post_process_passes\" title=\"django.contrib.staticfiles.storage.ManifestStaticFilesStorage.max_post_process_passes\"><code class=\"xref py py-attr docutils literal notranslate\">ManifestStaticFilesStorage.max_post_process_passes</code></a>.</p></li>\n<li><p>When using <code class=\"docutils literal notranslate\">ManifestStaticFilesStorage</code>, static files not found in the\nmanifest at runtime now raise a <code class=\"docutils literal notranslate\">ValueError</code> instead of returning an\nunchanged path. You can revert to the old behavior by setting\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage.manifest_strict\" title=\"django.contrib.staticfiles.storage.ManifestStaticFilesStorage.manifest_strict\"><code class=\"xref py py-attr docutils literal notranslate\">ManifestStaticFilesStorage.manifest_strict</code></a> to <code class=\"docutils literal notranslate\">False</code>.</p></li>\n</ul>\n</section>\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<p>This section describes changes that may be needed in third-party database\nbackends.</p>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">DatabaseOperations.time_trunc_sql()</code> method is added to support\n<code class=\"docutils literal notranslate\">TimeField</code> truncation. It accepts a <code class=\"docutils literal notranslate\">lookup_type</code> and <code class=\"docutils literal notranslate\">field_name</code>\narguments and returns the appropriate SQL to truncate the given time field\n<code class=\"docutils literal notranslate\">field_name</code> to a time object with only the given specificity. The\n<code class=\"docutils literal notranslate\">lookup_type</code> argument can be either <code class=\"docutils literal notranslate\">'hour'</code>, <code class=\"docutils literal notranslate\">'minute'</code>, or\n<code class=\"docutils literal notranslate\">'second'</code>.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">DatabaseOperations.datetime_cast_time_sql()</code> method is added to\nsupport the <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#std-fieldlookup-time\"><code class=\"xref std std-lookup docutils literal notranslate\">time</code></a> lookup. It accepts a <code class=\"docutils literal notranslate\">field_name</code> and <code class=\"docutils literal notranslate\">tzname</code>\narguments and returns the SQL necessary to cast a datetime value to time\nvalue.</p></li>\n<li><p>To enable <code class=\"docutils literal notranslate\">FOR UPDATE SKIP LOCKED</code> support, set\n<code class=\"docutils literal notranslate\">DatabaseFeatures.has_select_for_update_skip_locked = True</code>.</p></li>\n<li><p>The new <code class=\"docutils literal notranslate\">DatabaseFeatures.supports_index_column_ordering</code> attribute\nspecifies if a database allows defining ordering for columns in indexes. The\ndefault value is <code class=\"docutils literal notranslate\">True</code> and the <code class=\"docutils literal notranslate\">DatabaseIntrospection.get_constraints()</code>\nmethod should include an <code class=\"docutils literal notranslate\">'orders'</code> key in each of the returned\ndictionaries with a list of <code class=\"docutils literal notranslate\">'ASC'</code> and/or <code class=\"docutils literal notranslate\">'DESC'</code> values corresponding\nto the ordering of each column in the index.</p></li>\n<li><p><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> no longer calls <code class=\"docutils literal notranslate\">DatabaseIntrospection.get_indexes()</code>\nwhich is deprecated. Custom database backends should ensure all types of\nindexes are returned by <code class=\"docutils literal notranslate\">DatabaseIntrospection.get_constraints()</code>.</p></li>\n<li><p>Renamed the <code class=\"docutils literal notranslate\">ignores_quoted_identifier_case</code> feature to\n<code class=\"docutils literal notranslate\">ignores_table_name_case</code> to more accurately reflect how it is used.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">name</code> keyword argument is added to the\n<code class=\"docutils literal notranslate\">DatabaseWrapper.create_cursor(self, name=None)</code> method to allow usage of\nserver-side cursors on backends that support it.</p></li>\n</ul>\n</section>\n<section id=\"dropped-support-for-postgresql-9-2-and-postgis-2-0\">\n<h3>Dropped support for PostgreSQL 9.2 and PostGIS 2.0<a class=\"heading-anchor\" href=\"#dropped-support-for-postgresql-9-2-and-postgis-2-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Upstream support for PostgreSQL 9.2 ends in September 2017. As a consequence,\nDjango 1.11 sets PostgreSQL 9.3 as the minimum version it officially supports.</p>\n<p>Support for PostGIS 2.0 is also removed as PostgreSQL 9.2 is the last version\nto support it.</p>\n<p>Also, the minimum supported version of psycopg2 is increased from 2.4.5 to\n2.5.4.</p>\n</section>\n<section id=\"liveservertestcase-binds-to-port-zero\">\n<span id=\"liveservertestcase-port-zero-change\"></span><h3><code class=\"docutils literal notranslate\">LiveServerTestCase</code> binds to port zero<a class=\"heading-anchor\" href=\"#liveservertestcase-binds-to-port-zero\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Rather than taking a port range and iterating to find a free port,\n<code class=\"docutils literal notranslate\">LiveServerTestCase</code> binds to port zero and relies on the operating system\nto assign a free port. The <code class=\"docutils literal notranslate\">DJANGO_LIVE_TEST_SERVER_ADDRESS</code> environment\nvariable is no longer used, and as it’s also no longer used, the\n<code class=\"docutils literal notranslate\">manage.py test --liveserver</code> option is removed.</p>\n<p>If you need to bind <code class=\"docutils literal notranslate\">LiveServerTestCase</code> to a specific port, use the <code class=\"docutils literal notranslate\">port</code>\nattribute added in Django 1.11.2.</p>\n</section>\n<section id=\"protection-against-insecure-redirects-in-django-contrib-auth-and-i18n-views\">\n<h3>Protection against insecure redirects in <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> and <code class=\"docutils literal notranslate\">i18n</code> views<a class=\"heading-anchor\" href=\"#protection-against-insecure-redirects-in-django-contrib-auth-and-i18n-views\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">LoginView</code>, <code class=\"docutils literal notranslate\">LogoutView</code> (and the deprecated function-based equivalents),\nand <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> protect users from being redirected\nto non-HTTPS <code class=\"docutils literal notranslate\">next</code> URLs when the app is running over HTTPS.</p>\n</section>\n<section id=\"queryset-get-or-create-and-update-or-create-validate-arguments\">\n<h3><code class=\"docutils literal notranslate\">QuerySet.get_or_create()</code> and <code class=\"docutils literal notranslate\">update_or_create()</code> validate arguments<a class=\"heading-anchor\" href=\"#queryset-get-or-create-and-update-or-create-validate-arguments\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>To prevent typos from passing silently,\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.get_or_create\" title=\"django.db.models.query.QuerySet.get_or_create\"><code class=\"xref py py-meth docutils literal notranslate\">get_or_create()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.update_or_create\" title=\"django.db.models.query.QuerySet.update_or_create\"><code class=\"xref py py-meth docutils literal notranslate\">update_or_create()</code></a> check that their\narguments are model fields. This should be backwards-incompatible only in the\nfact that it might expose a bug in your project.</p>\n</section>\n<section id=\"pytz-is-a-required-dependency-and-support-for-settings-time-zone-none-is-removed\">\n<h3><code class=\"docutils literal notranslate\">pytz</code> is a required dependency and support for <code class=\"docutils literal notranslate\">settings.TIME_ZONE = None</code> is removed<a class=\"heading-anchor\" href=\"#pytz-is-a-required-dependency-and-support-for-settings-time-zone-none-is-removed\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>To simplify Django’s timezone handling, <code class=\"docutils literal notranslate\">pytz</code> is now a required dependency.\nIt’s automatically installed along with Django.</p>\n<p>Support for <code class=\"docutils literal notranslate\">settings.TIME_ZONE = None</code> is removed as the behavior isn’t\ncommonly used and is questionably useful. If you want to automatically detect\nthe timezone based on the system timezone, you can use <a class=\"extlink-pypi reference external\" href=\"https://pypi.org/project/tzlocal/\">tzlocal</a>:</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\">tzlocal</span> <span class=\"kn\">import</span> get_localzone\n\nTIME_ZONE <span class=\"o\">=</span> get_localzone<span class=\"p\">()</span><span class=\"o\">.</span>zone\n</code></pre></div>\n<p>This works similar to <code class=\"docutils literal notranslate\">settings.TIME_ZONE = None</code> except that it also sets\n<code class=\"docutils literal notranslate\">os.environ['TZ']</code>. <a class=\"reference external\" href=\"https://groups.google.com/g/django-developers/c/OAV3FChfuPM/discussion\">Let us know</a>\nif there’s a use case where you find you can’t adapt your code to set a\n<code class=\"docutils literal notranslate\">TIME_ZONE</code>.</p>\n</section>\n<section id=\"html-changes-in-admin-templates\">\n<h3>HTML changes in admin templates<a class=\"heading-anchor\" href=\"#html-changes-in-admin-templates\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">&lt;p class=&quot;help&quot;&gt;</code> is replaced with a <code class=\"docutils literal notranslate\">&lt;div&gt;</code> tag to allow including lists\ninside help text.</p>\n<p>Read-only fields are wrapped in <code class=\"docutils literal notranslate\">&lt;div class=&quot;readonly&quot;&gt;...&lt;/div&gt;</code> instead of\n<code class=\"docutils literal notranslate\">&lt;p&gt;...&lt;/p&gt;</code> to allow any kind of HTML as the field’s content.</p>\n</section>\n<section id=\"changes-due-to-the-introduction-of-template-based-widget-rendering\">\n<span id=\"template-widget-incompatibilities-1-11\"></span><h3>Changes due to the introduction of template-based widget rendering<a class=\"heading-anchor\" href=\"#changes-due-to-the-introduction-of-template-based-widget-rendering\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Some undocumented classes in <code class=\"docutils literal notranslate\">django.forms.widgets</code> are removed:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">SubWidget</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">RendererMixin</code>, <code class=\"docutils literal notranslate\">ChoiceFieldRenderer</code>, <code class=\"docutils literal notranslate\">RadioFieldRenderer</code>,\n<code class=\"docutils literal notranslate\">CheckboxFieldRenderer</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">ChoiceInput</code>, <code class=\"docutils literal notranslate\">RadioChoiceInput</code>, <code class=\"docutils literal notranslate\">CheckboxChoiceInput</code></p></li>\n</ul>\n<p>The undocumented <code class=\"docutils literal notranslate\">Select.render_option()</code> method is removed.</p>\n<p>The <code class=\"docutils literal notranslate\">Widget.format_output()</code> method is removed. Use a custom widget template\ninstead.</p>\n<p>Some widget values, such as <code class=\"docutils literal notranslate\">&lt;select&gt;</code> options, are now localized if\n<code class=\"docutils literal notranslate\">settings.USE_L10N=True</code>. You could revert to the old behavior with custom\nwidget templates that uses the <a class=\"reference internal\" href=\"/en/dev/topics/i18n/formatting/#std-templatetag-localize\"><code class=\"xref std std-ttag docutils literal notranslate\">localize</code></a> template tag to turn off\nlocalization.</p>\n</section>\n<section id=\"django-template-backends-django-template-render-prohibits-non-dict-context\">\n<h3><code class=\"docutils literal notranslate\">django.template.backends.django.Template.render()</code> prohibits non-dict context<a class=\"heading-anchor\" href=\"#django-template-backends-django-template-render-prohibits-non-dict-context\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>For compatibility with multiple template engines,\n<code class=\"docutils literal notranslate\">django.template.backends.django.Template.render()</code> (returned from high-level\ntemplate loader APIs such as <code class=\"docutils literal notranslate\">loader.get_template()</code>) must receive a\ndictionary of context rather than <code class=\"docutils literal notranslate\">Context</code> or <code class=\"docutils literal notranslate\">RequestContext</code>. If you\nwere passing either of the two classes, pass a dictionary instead – doing so\nis backwards-compatible with older versions of Django.</p>\n</section>\n<section id=\"model-state-changes-in-migration-operations\">\n<h3>Model state changes in migration operations<a class=\"heading-anchor\" href=\"#model-state-changes-in-migration-operations\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>To improve the speed of applying migrations, rendering of related models is\ndelayed until an operation that needs them (e.g. <code class=\"docutils literal notranslate\">RunPython</code>). If you have a\ncustom operation that works with model classes or model instances from the\n<code class=\"docutils literal notranslate\">from_state</code> argument in <code class=\"docutils literal notranslate\">database_forwards()</code> or <code class=\"docutils literal notranslate\">database_backwards()</code>,\nyou must render model states using the <code class=\"docutils literal notranslate\">clear_delayed_apps_cache()</code> method as\ndescribed in <a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#writing-your-own-migration-operation\"><span class=\"std std-ref\">writing your own migration operation</span></a>.</p>\n</section>\n<section id=\"server-side-cursors-on-postgresql\">\n<h3>Server-side cursors on PostgreSQL<a class=\"heading-anchor\" href=\"#server-side-cursors-on-postgresql\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The change to make <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.iterator\" title=\"django.db.models.query.QuerySet.iterator\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.iterator()</code></a> use server-side cursors on\nPostgreSQL prevents running Django with PgBouncer in transaction pooling mode.\nTo reallow that, use the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATABASE-DISABLE_SERVER_SIDE_CURSORS\"><code class=\"xref std std-setting docutils literal notranslate\">DISABLE_SERVER_SIDE_CURSORS</code></a> setting (added in Django 1.11.1) in\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATABASES\"><code class=\"xref std std-setting docutils literal notranslate\">DATABASES</code></a>.</p>\n<p>See <a class=\"reference internal\" href=\"/en/dev/ref/databases/#transaction-pooling-server-side-cursors\"><span class=\"std std-ref\">Transaction pooling and server-side cursors</span></a> for more discussion.</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>\n<li><p>If no items in the feed have a <code class=\"docutils literal notranslate\">pubdate</code> or <code class=\"docutils literal notranslate\">updateddate</code> attribute,\n<a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.feedgenerator.SyndicationFeed.latest_post_date\" title=\"django.utils.feedgenerator.SyndicationFeed.latest_post_date\"><code class=\"xref py py-meth docutils literal notranslate\">SyndicationFeed.latest_post_date()</code></a> now returns\nthe current UTC date/time, instead of a datetime without any timezone\ninformation.</p></li>\n<li><p>CSRF failures are logged to the <code class=\"docutils literal notranslate\">django.security.csrf</code> logger instead of\n<code class=\"docutils literal notranslate\">django.request</code>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-ALLOWED_HOSTS\"><code class=\"xref std std-setting docutils literal notranslate\">ALLOWED_HOSTS</code></a> validation is no longer disabled when running tests.\nIf your application includes tests with custom host names, you must include\nthose host names in <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-ALLOWED_HOSTS\"><code class=\"xref std std-setting docutils literal notranslate\">ALLOWED_HOSTS</code></a>. See\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#topics-testing-advanced-multiple-hosts\"><span class=\"std std-ref\">Tests and multiple host names</span></a>.</p></li>\n<li><p>Using a foreign key’s id (e.g. <code class=\"docutils literal notranslate\">'field_id'</code>) in <code class=\"docutils literal notranslate\">ModelAdmin.list_display</code>\ndisplays the related object’s ID. Remove the <code class=\"docutils literal notranslate\">_id</code> suffix if you want the\nold behavior of the string representation of the object.</p></li>\n<li><p>In model forms, <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 <code class=\"docutils literal notranslate\">null=True</code> now\nsaves <code class=\"docutils literal notranslate\">NULL</code> for blank values instead of empty strings.</p></li>\n<li><p>On Oracle, <a class=\"reference internal\" href=\"/en/dev/ref/models/instances/#django.db.models.Model.validate_unique\" title=\"django.db.models.Model.validate_unique\"><code class=\"xref py py-meth docutils literal notranslate\">Model.validate_unique()</code></a> no longer checks empty strings for\nuniqueness as the database interprets the value as <code class=\"docutils literal notranslate\">NULL</code>.</p></li>\n<li><p>If you subclass <a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.models.AbstractUser\" title=\"django.contrib.auth.models.AbstractUser\"><code class=\"xref py py-class docutils literal notranslate\">AbstractUser</code></a> 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.BaseUserManager.normalize_email\" title=\"django.contrib.auth.models.BaseUserManager.normalize_email\"><code class=\"xref py py-meth docutils literal notranslate\">BaseUserManager.normalize_email()</code></a> is called in a\nnew <a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.models.AbstractUser.clean\" title=\"django.contrib.auth.models.AbstractUser.clean\"><code class=\"xref py py-meth docutils literal notranslate\">AbstractUser.clean()</code></a> method so that normalization is applied in\ncases like model form validation.</p></li>\n<li><p><code class=\"docutils literal notranslate\">EmailField</code> and <code class=\"docutils literal notranslate\">URLField</code> no longer accept the <code class=\"docutils literal notranslate\">strip</code> keyword\nargument. Remove it because it doesn’t have an effect in older versions of\nDjango as these fields always strip whitespace.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">checked</code> and <code class=\"docutils literal notranslate\">selected</code> attribute rendered by form widgets now uses\nHTML5 boolean syntax rather than XHTML’s <code class=\"docutils literal notranslate\">checked='checked'</code> and\n<code class=\"docutils literal notranslate\">selected='selected'</code>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/models/relations/#django.db.models.fields.related.RelatedManager.add\" title=\"django.db.models.fields.related.RelatedManager.add\"><code class=\"xref py py-meth docutils literal notranslate\">RelatedManager.add()</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/ref/models/relations/#django.db.models.fields.related.RelatedManager.remove\" title=\"django.db.models.fields.related.RelatedManager.remove\"><code class=\"xref py py-meth docutils literal notranslate\">remove()</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/ref/models/relations/#django.db.models.fields.related.RelatedManager.clear\" title=\"django.db.models.fields.related.RelatedManager.clear\"><code class=\"xref py py-meth docutils literal notranslate\">clear()</code></a>, and\n<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> now\nclear the <code class=\"docutils literal notranslate\">prefetch_related()</code> cache.</p></li>\n<li><p>To prevent possible loss of saved settings,\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.utils.setup_test_environment\" title=\"django.test.utils.setup_test_environment\"><code class=\"xref py py-func docutils literal notranslate\">setup_test_environment()</code></a> now raises an exception if\ncalled a second time before calling\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.utils.teardown_test_environment\" title=\"django.test.utils.teardown_test_environment\"><code class=\"xref py py-func docutils literal notranslate\">teardown_test_environment()</code></a>.</p></li>\n<li><p>The undocumented <code class=\"docutils literal notranslate\">DateTimeAwareJSONEncoder</code> alias for\n<a class=\"reference internal\" href=\"/en/dev/topics/serialization/#django.core.serializers.json.DjangoJSONEncoder\" title=\"django.core.serializers.json.DjangoJSONEncoder\"><code class=\"xref py py-class docutils literal notranslate\">DjangoJSONEncoder</code></a> (renamed in Django\n1.0) is removed.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.loaders.cached.Loader\" title=\"django.template.loaders.cached.Loader\"><code class=\"xref py py-class docutils literal notranslate\">cached template loader</code></a>\nis now enabled if <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-TEMPLATES-OPTIONS\"><code class=\"xref std std-setting docutils literal notranslate\">OPTIONS['loaders']</code></a> isn’t\nspecified and <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-TEMPLATES-OPTIONS\"><code class=\"xref std std-setting docutils literal notranslate\">OPTIONS['debug']</code></a> is <code class=\"docutils literal notranslate\">False</code>\n(the latter option defaults to the value of <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\">DEBUG</code></a>). This could\nbe backwards-incompatible if you have some <a class=\"reference internal\" href=\"/en/dev/howto/custom-template-tags/#template-tag-thread-safety\"><span class=\"std std-ref\">template tags that aren’t\nthread safe</span></a>.</p></li>\n<li><p>The prompt for stale content type deletion no longer occurs after running the\n<code class=\"docutils literal notranslate\">migrate</code> command. Use the new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-remove_stale_contenttypes\"><code class=\"xref std std-djadmin docutils literal notranslate\">remove_stale_contenttypes</code></a> command\ninstead.</p></li>\n<li><p>The admin’s widget for <code class=\"docutils literal notranslate\">IntegerField</code> uses <code class=\"docutils literal notranslate\">type=&quot;number&quot;</code> rather than\n<code class=\"docutils literal notranslate\">type=&quot;text&quot;</code>.</p></li>\n<li><p>Conditional HTTP headers are now parsed and compared according to the\n<span class=\"target\" id=\"index-0\"></span><a class=\"rfc reference external\" href=\"https://datatracker.ietf.org/doc/html/rfc7232.html\"><strong>RFC 7232</strong></a> Conditional Requests specification rather than the older\n<span class=\"target\" id=\"index-1\"></span><a class=\"rfc reference external\" href=\"https://datatracker.ietf.org/doc/html/rfc2616.html\"><strong>RFC 2616</strong></a>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.cache.patch_response_headers\" title=\"django.utils.cache.patch_response_headers\"><code class=\"xref py py-func docutils literal notranslate\">patch_response_headers()</code></a> no longer adds a\n<code class=\"docutils literal notranslate\">Last-Modified</code> header. According to the <span class=\"target\" id=\"index-2\"></span><a class=\"rfc reference external\" href=\"https://datatracker.ietf.org/doc/html/rfc7234.html#section-4.2.2\"><strong>RFC 7234 Section 4.2.2</strong></a>, this\nheader is useless alongside other caching headers that provide an explicit\nexpiration time, e.g. <code class=\"docutils literal notranslate\">Expires</code> or <code class=\"docutils literal notranslate\">Cache-Control</code>.\n<a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.cache.UpdateCacheMiddleware\" title=\"django.middleware.cache.UpdateCacheMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">UpdateCacheMiddleware</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.cache.add_never_cache_headers\" title=\"django.utils.cache.add_never_cache_headers\"><code class=\"xref py py-func docutils literal notranslate\">add_never_cache_headers()</code></a> call\n<code class=\"docutils literal notranslate\">patch_response_headers()</code> and therefore are also affected by this change.</p></li>\n<li><p>In the admin templates, <code class=\"docutils literal notranslate\">&lt;p class=&quot;help&quot;&gt;</code> is replaced with a <code class=\"docutils literal notranslate\">&lt;div&gt;</code> tag\nto allow including lists inside help text.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.http.ConditionalGetMiddleware\" title=\"django.middleware.http.ConditionalGetMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">ConditionalGetMiddleware</code></a> no longer sets the\n<code class=\"docutils literal notranslate\">Date</code> header as web servers set that header. It also no longer sets the\n<code class=\"docutils literal notranslate\">Content-Length</code> header as this is now done by\n<a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.common.CommonMiddleware\" title=\"django.middleware.common.CommonMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">CommonMiddleware</code></a>.</p>\n<p>If you have a middleware that modifies a response’s content and appears\nbefore <code class=\"docutils literal notranslate\">CommonMiddleware</code> in the <code class=\"docutils literal notranslate\">MIDDLEWARE</code> or <code class=\"docutils literal notranslate\">MIDDLEWARE_CLASSES</code>\nsettings, you must reorder your middleware so that responses aren’t modified\nafter <code class=\"docutils literal notranslate\">Content-Length</code> is set, or have the response modifying middleware\nreset the <code class=\"docutils literal notranslate\">Content-Length</code> header.</p>\n</li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/applications/#django.apps.AppConfig.get_model\" title=\"django.apps.AppConfig.get_model\"><code class=\"xref py py-meth docutils literal notranslate\">get_model()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/applications/#django.apps.AppConfig.get_models\" title=\"django.apps.AppConfig.get_models\"><code class=\"xref py py-meth docutils literal notranslate\">get_models()</code></a> now raise\n<a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.core.exceptions.AppRegistryNotReady\" title=\"django.core.exceptions.AppRegistryNotReady\"><code class=\"xref py py-exc docutils literal notranslate\">AppRegistryNotReady</code></a> if they’re called before\nmodels of all applications have been loaded. Previously they only required\nthe target application’s models to be loaded and thus could return models\nwithout all their relations set up. If you need the old behavior of\n<code class=\"docutils literal notranslate\">get_model()</code>, set the <code class=\"docutils literal notranslate\">require_ready</code> argument to <code class=\"docutils literal notranslate\">False</code>.</p></li>\n<li><p>The unused <code class=\"docutils literal notranslate\">BaseCommand.can_import_settings</code> attribute is removed.</p></li>\n<li><p>The undocumented <code class=\"docutils literal notranslate\">django.utils.functional.lazy_property</code> is removed.</p></li>\n<li><p>For consistency with non-multipart requests, <code class=\"docutils literal notranslate\">MultiPartParser.parse()</code> now\nleaves <code class=\"docutils literal notranslate\">request.POST</code> immutable. If you’re modifying that <code class=\"docutils literal notranslate\">QueryDict</code>,\nyou must now first copy it, e.g. <code class=\"docutils literal notranslate\">request.POST.copy()</code>.</p></li>\n<li><p>Support for <code class=\"docutils literal notranslate\">cx_Oracle</code> &lt; 5.2 is removed.</p></li>\n<li><p>Support for IPython &lt; 1.0 is removed from the <code class=\"docutils literal notranslate\">shell</code> command.</p></li>\n<li><p>The signature of private API <code class=\"docutils literal notranslate\">Widget.build_attrs()</code> changed from\n<code class=\"docutils literal notranslate\">extra_attrs=None, **kwargs</code> to <code class=\"docutils literal notranslate\">base_attrs, extra_attrs=None</code>.</p></li>\n<li><p>File-like objects (e.g., <a class=\"reference external\" href=\"https://docs.python.org/3/library/io.html#io.StringIO\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">StringIO</code></a> and <a class=\"reference external\" href=\"https://docs.python.org/3/library/io.html#io.BytesIO\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">BytesIO</code></a>)\nuploaded to an <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ImageField\" title=\"django.db.models.ImageField\"><code class=\"xref py py-class docutils literal notranslate\">ImageField</code></a> using the test client\nnow require a <code class=\"docutils literal notranslate\">name</code> attribute with a value that passes the\n<a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.validate_image_file_extension\" title=\"django.core.validators.validate_image_file_extension\"><code class=\"xref py py-data docutils literal notranslate\">validate_image_file_extension</code></a> validator.\nSee the note in <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.Client.post\" title=\"django.test.Client.post\"><code class=\"xref py py-meth docutils literal notranslate\">Client.post()</code></a>.</p></li>\n<li><p><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> now moves rather than copies the file\nit receives. With the default file upload settings, files larger than\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-FILE_UPLOAD_MAX_MEMORY_SIZE\"><code class=\"xref std std-setting docutils literal notranslate\">FILE_UPLOAD_MAX_MEMORY_SIZE</code></a> now have the same permissions as\ntemporary files (often <code class=\"docutils literal notranslate\">0o600</code>) rather than the system’s standard umask\n(often <code class=\"docutils literal notranslate\">0o6644</code>). Set the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-FILE_UPLOAD_PERMISSIONS\"><code class=\"xref std std-setting docutils literal notranslate\">FILE_UPLOAD_PERMISSIONS</code></a> if you need\nthe same permission regardless of file size.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"features-deprecated-in-1-11\">\n<span id=\"deprecated-features-1-11\"></span><h2>Features deprecated in 1.11<a class=\"heading-anchor\" href=\"#features-deprecated-in-1-11\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"models-permalink-decorator\">\n<h3><code class=\"docutils literal notranslate\">models.permalink()</code> decorator<a class=\"heading-anchor\" href=\"#models-permalink-decorator\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Use <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\">django.urls.reverse()</code></a> instead. 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</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    <span class=\"o\">...</span>\n\n    <span class=\"nd\">@models</span><span class=\"o\">.</span>permalink\n    <span class=\"k\">def</span> <span class=\"nf\">url</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"k\">return</span> <span class=\"p\">(</span><span class=\"s2\">&quot;guitarist_detail&quot;</span><span class=\"p\">,</span> <span class=\"p\">[</span><span class=\"bp\">self</span><span class=\"o\">.</span>slug<span class=\"p\">])</span>\n</code></pre></div>\n<p>becomes:</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<span class=\"kn\">from</span> <span class=\"nn\">django.urls</span> <span class=\"kn\">import</span> reverse\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    <span class=\"o\">...</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">url</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"k\">return</span> reverse<span class=\"p\">(</span><span class=\"s2\">&quot;guitarist_detail&quot;</span><span class=\"p\">,</span> args<span class=\"o\">=</span><span class=\"p\">[</span><span class=\"bp\">self</span><span class=\"o\">.</span>slug<span class=\"p\">])</span>\n</code></pre></div>\n</section>\n<section id=\"id2\">\n<h3>Miscellaneous<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><code class=\"docutils literal notranslate\">contrib.auth</code>’s <code class=\"docutils literal notranslate\">login()</code> and <code class=\"docutils literal notranslate\">logout()</code> function-based views are\ndeprecated in favor of new class-based views\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.LoginView\" title=\"django.contrib.auth.views.LoginView\"><code class=\"xref py py-class docutils literal notranslate\">LoginView</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.LogoutView\" title=\"django.contrib.auth.views.LogoutView\"><code class=\"xref py py-class docutils literal notranslate\">LogoutView</code></a>.</p></li>\n<li><p>The unused <code class=\"docutils literal notranslate\">extra_context</code> parameter of\n<code class=\"docutils literal notranslate\">contrib.auth.views.logout_then_login()</code>  is deprecated.</p></li>\n<li><p><code class=\"docutils literal notranslate\">contrib.auth</code>’s <code class=\"docutils literal notranslate\">password_change()</code>, <code class=\"docutils literal notranslate\">password_change_done()</code>,\n<code class=\"docutils literal notranslate\">password_reset()</code>, <code class=\"docutils literal notranslate\">password_reset_done()</code>,\n<code class=\"docutils literal notranslate\">password_reset_confirm()</code>, and <code class=\"docutils literal notranslate\">password_reset_complete()</code>\nfunction-based views are deprecated in favor of new class-based views\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordChangeView\" title=\"django.contrib.auth.views.PasswordChangeView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordChangeView</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordChangeDoneView\" title=\"django.contrib.auth.views.PasswordChangeDoneView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordChangeDoneView</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetView\" title=\"django.contrib.auth.views.PasswordResetView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetView</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetDoneView\" title=\"django.contrib.auth.views.PasswordResetDoneView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetDoneView</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetConfirmView\" title=\"django.contrib.auth.views.PasswordResetConfirmView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetConfirmView</code></a>, and\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.views.PasswordResetCompleteView\" title=\"django.contrib.auth.views.PasswordResetCompleteView\"><code class=\"xref py py-class docutils literal notranslate\">PasswordResetCompleteView</code></a>.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.test.runner.setup_databases()</code> is moved to\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.utils.setup_databases\" title=\"django.test.utils.setup_databases\"><code class=\"xref py py-func docutils literal notranslate\">django.test.utils.setup_databases()</code></a>. The old location is deprecated.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.translation.string_concat()</code> is deprecated in\nfavor of <a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.text.format_lazy\" title=\"django.utils.text.format_lazy\"><code class=\"xref py py-func docutils literal notranslate\">django.utils.text.format_lazy()</code></a>. <code class=\"docutils literal notranslate\">string_concat(*strings)</code>\ncan be replaced by <code class=\"docutils literal notranslate\">format_lazy('{}' * len(strings), *strings)</code>.</p></li>\n<li><p>For the <code class=\"docutils literal notranslate\">PyLibMCCache</code> cache backend, passing <code class=\"docutils literal notranslate\">pylibmc</code> behavior settings\nas top-level attributes of <code class=\"docutils literal notranslate\">OPTIONS</code> is deprecated. Set them under a\n<code class=\"docutils literal notranslate\">behaviors</code> key within <code class=\"docutils literal notranslate\">OPTIONS</code> instead.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">host</code> parameter of <code class=\"docutils literal notranslate\">django.utils.http.is_safe_url()</code> is deprecated\nin favor of the new <code class=\"docutils literal notranslate\">allowed_hosts</code> parameter.</p></li>\n<li><p>Silencing exceptions raised while rendering the\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 tag is deprecated as the behavior is\noften more confusing than helpful. In Django 2.1, the exception will be\nraised.</p></li>\n<li><p><code class=\"docutils literal notranslate\">DatabaseIntrospection.get_indexes()</code> is deprecated in favor of\n<code class=\"docutils literal notranslate\">DatabaseIntrospection.get_constraints()</code>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.authenticate\" title=\"django.contrib.auth.authenticate\"><code class=\"xref py py-func docutils literal notranslate\">authenticate()</code></a> now passes a <code class=\"docutils literal notranslate\">request</code> argument\nto the <code class=\"docutils literal notranslate\">authenticate()</code> method of authentication backends. Support for\nmethods that don’t accept <code class=\"docutils literal notranslate\">request</code> as the first positional argument will\nbe removed in Django 2.1.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">USE_ETAGS</code> setting is deprecated in favor of\n<a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.http.ConditionalGetMiddleware\" title=\"django.middleware.http.ConditionalGetMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">ConditionalGetMiddleware</code></a> which now adds the\n<code class=\"docutils literal notranslate\">ETag</code> header to responses regardless of the setting. <code class=\"docutils literal notranslate\">CommonMiddleware</code>\nand <code class=\"docutils literal notranslate\">django.utils.cache.patch_response_headers()</code> will no longer set ETags\nwhen the deprecation ends.</p></li>\n<li><p><code class=\"docutils literal notranslate\">Model._meta.has_auto_field</code> is deprecated in favor of checking if\n<code class=\"docutils literal notranslate\">Model._meta.auto_field is not None</code>.</p></li>\n<li><p>Using regular expression groups with <code class=\"docutils literal notranslate\">iLmsu#</code> in <code class=\"docutils literal notranslate\">url()</code> is deprecated.\nThe only group that’s useful is <code class=\"docutils literal notranslate\">(?i)</code> for case-insensitive URLs, however,\ncase-insensitive URLs aren’t a good practice because they create multiple\nentries for search engines, for example. An alternative solution could be to\ncreate a <a class=\"reference internal\" href=\"/en/dev/ref/urls/#django.conf.urls.handler404\" title=\"django.conf.urls.handler404\"><code class=\"xref py py-data docutils literal notranslate\">handler404</code></a> that looks for uppercase\ncharacters in the URL and redirects to a lowercase equivalent.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">renderer</code> argument is added to the <a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.Widget.render\" title=\"django.forms.Widget.render\"><code class=\"xref py py-meth docutils literal notranslate\">Widget.render()</code></a> method. Methods that don’t accept that argument\nwill work through a deprecation period.</p></li>\n</ul>\n</section>\n</section>","rootId":"django-1-11-release-notes","toc":[{"title":"Python compatibility","anchor":"python-compatibility","children":[]},{"title":"Deprecating warnings are no longer loud by default","anchor":"deprecating-warnings-are-no-longer-loud-by-default","children":[]},{"title":"What’s new in Django 1.11","anchor":"what-s-new-in-django-1-11","children":[{"title":"Class-based model indexes","anchor":"class-based-model-indexes","children":[]},{"title":"Template-based widget rendering","anchor":"template-based-widget-rendering","children":[]},{"title":"Subquery expressions","anchor":"subquery-expressions","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.contenttypes","anchor":"django-contrib-contenttypes","children":[]},{"title":"django.contrib.gis","anchor":"django-contrib-gis","children":[]},{"title":"django.contrib.postgres","anchor":"django-contrib-postgres","children":[]},{"title":"Cache","anchor":"cache","children":[]},{"title":"CSRF","anchor":"csrf","children":[]},{"title":"Database backends","anchor":"database-backends","children":[]},{"title":"Email","anchor":"email","children":[]},{"title":"File Storage","anchor":"file-storage","children":[]},{"title":"Forms","anchor":"forms","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":"Validators","anchor":"validators","children":[]}]}]},{"title":"Backwards incompatible changes in 1.11","anchor":"backwards-incompatible-changes-in-1-11","children":[{"title":"django.contrib.gis","anchor":"id1","children":[]},{"title":"django.contrib.staticfiles","anchor":"django-contrib-staticfiles","children":[]},{"title":"Database backend API","anchor":"database-backend-api","children":[]},{"title":"Dropped support for PostgreSQL 9.2 and PostGIS 2.0","anchor":"dropped-support-for-postgresql-9-2-and-postgis-2-0","children":[]},{"title":"LiveServerTestCase binds to port zero","anchor":"liveservertestcase-binds-to-port-zero","children":[]},{"title":"Protection against insecure redirects in django.contrib.auth and i18n views","anchor":"protection-against-insecure-redirects-in-django-contrib-auth-and-i18n-views","children":[]},{"title":"QuerySet.get_or_create() and update_or_create() validate arguments","anchor":"queryset-get-or-create-and-update-or-create-validate-arguments","children":[]},{"title":"pytz is a required dependency and support for settings.TIME_ZONE = None is removed","anchor":"pytz-is-a-required-dependency-and-support-for-settings-time-zone-none-is-removed","children":[]},{"title":"HTML changes in admin templates","anchor":"html-changes-in-admin-templates","children":[]},{"title":"Changes due to the introduction of template-based widget rendering","anchor":"changes-due-to-the-introduction-of-template-based-widget-rendering","children":[]},{"title":"django.template.backends.django.Template.render() prohibits non-dict context","anchor":"django-template-backends-django-template-render-prohibits-non-dict-context","children":[]},{"title":"Model state changes in migration operations","anchor":"model-state-changes-in-migration-operations","children":[]},{"title":"Server-side cursors on PostgreSQL","anchor":"server-side-cursors-on-postgresql","children":[]},{"title":"Miscellaneous","anchor":"miscellaneous","children":[]}]},{"title":"Features deprecated in 1.11","anchor":"features-deprecated-in-1-11","children":[{"title":"models.permalink() decorator","anchor":"models-permalink-decorator","children":[]},{"title":"Miscellaneous","anchor":"id2","children":[]}]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.11.1","title":"Django 1.11.1 release notes","url":"/en/dev/releases/1.11.1/"},"next":{"docname":"releases/1.10.8","title":"Django 1.10.8 release notes","url":"/en/dev/releases/1.10.8/"},"formats":{"html":"/en/dev/releases/1.11/","markdown":"/en/dev/releases/1.11.md","json":"/en/dev/releases/1.11.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.11.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.11/","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"],"inLocales":["en"]}