{"title":"Django 1.8 release notes","version":"dev","locale":"en","docname":"releases/1.8","url":"/en/dev/releases/1.8/","canonical":"https://djangodocs.dev/en/dev/releases/1.8/","summary":"Welcome to Django 1.8! 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.8 release notes<a class=\"heading-anchor\" href=\"#django-1-8-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>April 1, 2015</em></p>\n<p>Welcome to Django 1.8!</p>\n<p>These release notes cover the <a class=\"reference internal\" href=\"#whats-new-1-8\"><span class=\"std std-ref\">new features</span></a>, as well as\nsome <a class=\"reference internal\" href=\"#backwards-incompatible-1-8\"><span class=\"std std-ref\">backwards incompatible changes</span></a> you’ll\nwant to be aware of when upgrading from Django 1.7 or older versions. We’ve\nalso <a class=\"reference internal\" href=\"#deprecated-features-1-8\"><span class=\"std std-ref\">begun the deprecation process for some features</span></a>, and some features have reached the end of their\ndeprecation process and <a class=\"reference internal\" href=\"#removed-features-1-8\"><span class=\"std std-ref\">have been removed</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.8 has been designated as Django’s second <a class=\"reference internal\" href=\"/en/dev/internals/release-process/#term-Long-term-support-release\"><span class=\"xref std std-term\">long-term support\nrelease</span></a>. It will receive security updates for at\nleast three years after its release. Support for the previous LTS, Django 1.4,\nwill end 6 months from the release date of Django 1.8.</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.8 requires Python 2.7, 3.2, 3.3, 3.4, or 3.5. We <strong>highly recommend</strong>\nand only officially support the latest release of each series.</p>\n<p>Django 1.8 is the first release to support Python 3.5.</p>\n<p>Due to the end of upstream support for Python 3.2 in February 2016, we won’t\ntest Django 1.8.x on Python 3.2 after the end of 2016.</p>\n</section>\n<section id=\"what-s-new-in-django-1-8\">\n<span id=\"whats-new-1-8\"></span><h2>What’s new in Django 1.8<a class=\"heading-anchor\" href=\"#what-s-new-in-django-1-8\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"model-meta-api\">\n<h3><code class=\"docutils literal notranslate\">Model._meta</code> API<a class=\"heading-anchor\" href=\"#model-meta-api\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django now has a formalized API for <a class=\"reference internal\" href=\"/en/dev/ref/models/meta/\"><span class=\"doc\">Model._meta</span></a>,\nproviding an officially supported way to <a class=\"reference internal\" href=\"/en/dev/ref/models/meta/#model-meta-field-api\"><span class=\"std std-ref\">retrieve fields</span></a> and filter fields based on their <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#model-field-attributes\"><span class=\"std std-ref\">attributes</span></a>.</p>\n<p>The <code class=\"docutils literal notranslate\">Model._meta</code> object has been part of Django since the days of pre-0.96\n“Magic Removal” – it just wasn’t an official, stable API. In recognition of\nthis, we’ve endeavored to maintain backwards-compatibility with the old\nAPI endpoint where possible. However, API endpoints that aren’t part of the\nnew official API have been deprecated and will eventually be removed.</p>\n</section>\n<section id=\"multiple-template-engines\">\n<h3>Multiple template engines<a class=\"heading-anchor\" href=\"#multiple-template-engines\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.8 defines a stable API for integrating template backends. It includes\nbuilt-in support for the Django template language and for\n<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>. It supports rendering\ntemplates with multiple engines within the same project. Learn more about the\nnew features in the <a class=\"reference internal\" href=\"/en/dev/topics/templates/\"><span class=\"doc\">topic guide</span></a> and check the\nupgrade instructions in older versions of the documentation.</p>\n</section>\n<section id=\"security-enhancements\">\n<h3>Security enhancements<a class=\"heading-anchor\" href=\"#security-enhancements\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Several features of the <a class=\"extlink-pypi reference external\" href=\"https://pypi.org/project/django-secure/\">django-secure</a> third-party library have been\nintegrated into Django. <a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.security.SecurityMiddleware\" title=\"django.middleware.security.SecurityMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">django.middleware.security.SecurityMiddleware</code></a>\nprovides several security enhancements to the request/response cycle. The new\n<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-check-deploy\"><code class=\"xref std std-option docutils literal notranslate\">check --deploy</code></a> option allows you to check your production settings\nfile for ways to increase the security of your site.</p>\n</section>\n<section id=\"new-postgresql-specific-functionality\">\n<h3>New PostgreSQL specific functionality<a class=\"heading-anchor\" href=\"#new-postgresql-specific-functionality\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django now has a module with extensions for PostgreSQL specific features, such\nas <a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/fields/#django.contrib.postgres.fields.ArrayField\" title=\"django.contrib.postgres.fields.ArrayField\"><code class=\"xref py py-class docutils literal notranslate\">ArrayField</code></a>,\n<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>, <a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/fields/#range-fields\"><span class=\"std std-ref\">Range Fields</span></a>, and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/lookups/#std-fieldlookup-unaccent\"><code class=\"xref std std-lookup docutils literal notranslate\">unaccent</code></a> lookup. A full breakdown of the features is available\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/\"><span class=\"doc\">in the documentation</span></a>.</p>\n</section>\n<section id=\"new-data-types\">\n<h3>New data types<a class=\"heading-anchor\" href=\"#new-data-types\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>Django now has a <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.UUIDField\" title=\"django.db.models.UUIDField\"><code class=\"xref py py-class docutils literal notranslate\">UUIDField</code></a> for storing\nuniversally unique identifiers. It is stored as the native <code class=\"docutils literal notranslate\">uuid</code> data type\non PostgreSQL and as a fixed length character field on other backends. There\nis a corresponding <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.UUIDField\" title=\"django.forms.UUIDField\"><code class=\"xref py py-class docutils literal notranslate\">form field</code></a>.</p></li>\n<li><p>Django now has a <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> for storing periods\nof time - modeled in Python by <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>. It is\nstored in the native <code class=\"docutils literal notranslate\">interval</code> data type on PostgreSQL, as a <code class=\"docutils literal notranslate\">INTERVAL\nDAY(9) TO SECOND(6)</code> on Oracle, and as a <code class=\"docutils literal notranslate\">bigint</code> of microseconds on other\nbackends. Date and time related arithmetic has also been improved on all\nbackends. There is a corresponding <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.DurationField\" title=\"django.forms.DurationField\"><code class=\"xref py py-class docutils literal notranslate\">form field</code></a>.</p></li>\n</ul>\n</section>\n<section id=\"query-expressions-conditional-expressions-and-database-functions\">\n<h3>Query Expressions, Conditional Expressions, and Database Functions<a class=\"heading-anchor\" href=\"#query-expressions-conditional-expressions-and-database-functions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/\"><span class=\"doc\">Query Expressions</span></a> allow you to create,\ncustomize, and compose complex SQL expressions. This has enabled annotate\nto accept expressions other than aggregates. Aggregates are now able to\nreference multiple fields, as well as perform arithmetic, similar to <code class=\"docutils literal notranslate\">F()</code>\nobjects. <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.order_by\" title=\"django.db.models.query.QuerySet.order_by\"><code class=\"xref py py-meth docutils literal notranslate\">order_by()</code></a> has also gained the\nability to accept expressions.</p>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/models/conditional-expressions/\"><span class=\"doc\">Conditional Expressions</span></a> allow\nyou to use <a class=\"reference external\" href=\"https://docs.python.org/3/reference/compound_stmts.html#if\" title=\"(in Python v3.14)\"><code class=\"xref std std-keyword docutils literal notranslate\">if</code></a> … <a class=\"reference external\" href=\"https://docs.python.org/3/reference/compound_stmts.html#elif\" title=\"(in Python v3.14)\"><code class=\"xref std std-keyword docutils literal notranslate\">elif</code></a> … <a class=\"reference external\" href=\"https://docs.python.org/3/reference/compound_stmts.html#else\" title=\"(in Python v3.14)\"><code class=\"xref std std-keyword docutils literal notranslate\">else</code></a> logic within\nqueries.</p>\n<p>A collection of <a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/\"><span class=\"doc\">database functions</span></a> is\nalso included with functionality such as\n<a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.Coalesce\" title=\"django.db.models.functions.Coalesce\"><code class=\"xref py py-class docutils literal notranslate\">Coalesce</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.Concat\" title=\"django.db.models.functions.Concat\"><code class=\"xref py py-class docutils literal notranslate\">Concat</code></a>, and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/database-functions/#django.db.models.functions.Substr\" title=\"django.db.models.functions.Substr\"><code class=\"xref py py-class docutils literal notranslate\">Substr</code></a>.</p>\n</section>\n<section id=\"testcase-data-setup\">\n<h3><code class=\"docutils literal notranslate\">TestCase</code> data setup<a class=\"heading-anchor\" href=\"#testcase-data-setup\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TestCase\" title=\"django.test.TestCase\"><code class=\"xref py py-class docutils literal notranslate\">TestCase</code></a> has been refactored to allow for data\ninitialization at the class level using transactions and savepoints. Database\nbackends which do not support transactions, like MySQL with the MyISAM storage\nengine, will still be able to run these tests but won’t benefit from the\nimprovements. Tests are now run within two nested\n<a class=\"reference internal\" href=\"/en/dev/topics/db/transactions/#django.db.transaction.atomic\" title=\"django.db.transaction.atomic\"><code class=\"xref py py-func docutils literal notranslate\">atomic()</code></a> blocks: one for the whole class and one\nfor each test.</p>\n<ul class=\"simple\">\n<li><p>The class method\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TestCase.setUpTestData\" title=\"django.test.TestCase.setUpTestData\"><code class=\"xref py py-meth docutils literal notranslate\">TestCase.setUpTestData()</code></a> adds\nthe ability to set up test data at the class level. Using this technique can\nspeed up the tests as compared to using <code class=\"docutils literal notranslate\">setUp()</code>.</p></li>\n<li><p>Fixture loading within <code class=\"docutils literal notranslate\">TestCase</code> is now performed once for the whole\n<code class=\"docutils literal notranslate\">TestCase</code>.</p></li>\n</ul>\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\" title=\"django.contrib.admin.ModelAdmin\"><code class=\"xref py py-class docutils literal notranslate\">ModelAdmin</code></a> now has a\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.has_module_permission\" title=\"django.contrib.admin.ModelAdmin.has_module_permission\"><code class=\"xref py py-meth docutils literal notranslate\">has_module_permission()</code></a>\nmethod to allow limiting access to the module on the admin index page.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin\" title=\"django.contrib.admin.InlineModelAdmin\"><code class=\"xref py py-class docutils literal notranslate\">InlineModelAdmin</code></a> now has an attribute\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.show_change_link\" title=\"django.contrib.admin.InlineModelAdmin.show_change_link\"><code class=\"xref py py-attr docutils literal notranslate\">show_change_link</code></a> that\nsupports showing a link to an inline object’s change form.</p></li>\n<li><p>Use the new <code class=\"docutils literal notranslate\">django.contrib.admin.RelatedOnlyFieldListFilter</code> in\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter\" title=\"django.contrib.admin.ModelAdmin.list_filter\"><code class=\"xref py py-attr docutils literal notranslate\">ModelAdmin.list_filter</code></a>\nto limit the <code class=\"docutils literal notranslate\">list_filter</code> choices to foreign objects which are attached to\nthose from the <code class=\"docutils literal notranslate\">ModelAdmin</code>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.delete_view\" title=\"django.contrib.admin.ModelAdmin.delete_view\"><code class=\"xref py py-meth docutils literal notranslate\">ModelAdmin.delete_view()</code></a> displays a summary of objects\nto be deleted on the deletion confirmation page.</p></li>\n<li><p>The jQuery library embedded in the admin has been upgraded to version 1.11.2.</p></li>\n<li><p>You can now specify <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.AdminSite.site_url\" title=\"django.contrib.admin.AdminSite.site_url\"><code class=\"xref py py-attr docutils literal notranslate\">AdminSite.site_url</code></a> in order to display a link to the\nfront-end site.</p></li>\n<li><p>You can now specify <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.show_full_result_count\" title=\"django.contrib.admin.ModelAdmin.show_full_result_count\"><code class=\"xref py py-attr docutils literal notranslate\">ModelAdmin.show_full_result_count</code></a> to control whether\nor not the full count of objects should be displayed on a filtered admin\npage.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">AdminSite.password_change()</code> method now has an <code class=\"docutils literal notranslate\">extra_context</code>\nparameter.</p></li>\n<li><p>You can now control who may login to the admin site by overriding only\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.AdminSite.has_permission\" title=\"django.contrib.admin.AdminSite.has_permission\"><code class=\"xref py py-meth docutils literal notranslate\">AdminSite.has_permission()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.AdminSite.login_form\" title=\"django.contrib.admin.AdminSite.login_form\"><code class=\"xref py py-attr docutils literal notranslate\">AdminSite.login_form</code></a>.\nThe <code class=\"docutils literal notranslate\">base.html</code> template has a new block <code class=\"docutils literal notranslate\">usertools</code> which contains the\nuser-specific header. A new context variable <code class=\"docutils literal notranslate\">has_permission</code>, which gets\nits value from <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.AdminSite.has_permission\" title=\"django.contrib.admin.AdminSite.has_permission\"><code class=\"xref py py-meth docutils literal notranslate\">has_permission()</code></a>,\nindicates whether the user may access the site.</p></li>\n<li><p>Foreign key dropdowns now have buttons for changing or deleting related\nobjects using a popup.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-admindocs\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/admindocs/#module-django.contrib.admindocs\" title=\"django.contrib.admindocs: Django's admin documentation generator.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.admindocs</code></a><a class=\"heading-anchor\" href=\"#django-contrib-admindocs\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>reStructuredText is now parsed in model docstrings.</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>Authorization backends can now raise\n<a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.core.exceptions.PermissionDenied\" title=\"django.core.exceptions.PermissionDenied\"><code class=\"xref py py-class docutils literal notranslate\">PermissionDenied</code></a> in\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.User.has_perm\" title=\"django.contrib.auth.models.User.has_perm\"><code class=\"xref py py-meth docutils literal notranslate\">has_perm()</code></a>\nand <a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.User.has_module_perms\" title=\"django.contrib.auth.models.User.has_module_perms\"><code class=\"xref py py-meth docutils literal notranslate\">has_module_perms()</code></a>\nto short-circuit permission checking.</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> now\nhas a method <a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.forms.PasswordResetForm.send_mail\" title=\"django.contrib.auth.forms.PasswordResetForm.send_mail\"><code class=\"xref py py-meth docutils literal notranslate\">send_mail()</code></a>\nthat can be overridden to customize the mail to be sent.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">max_length</code> of <a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.Permission.name\" title=\"django.contrib.auth.models.Permission.name\"><code class=\"xref py py-attr docutils literal notranslate\">Permission.name</code></a> has been increased from 50 to\n255 characters. Please run the database migration.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.models.CustomUser.USERNAME_FIELD\" title=\"django.contrib.auth.models.CustomUser.USERNAME_FIELD\"><code class=\"xref py py-attr docutils literal notranslate\">USERNAME_FIELD</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#django.contrib.auth.models.CustomUser.REQUIRED_FIELDS\" title=\"django.contrib.auth.models.CustomUser.REQUIRED_FIELDS\"><code class=\"xref py py-attr docutils literal notranslate\">REQUIRED_FIELDS</code></a> now supports\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ForeignKey\" title=\"django.db.models.ForeignKey\"><code class=\"xref py py-class docutils literal notranslate\">ForeignKey</code></a>s.</p></li>\n<li><p>The default iteration count for the PBKDF2 password hasher has been\nincreased by 33%. This backwards compatible change will not affect users who\nhave subclassed <code class=\"docutils literal notranslate\">django.contrib.auth.hashers.PBKDF2PasswordHasher</code> to\nchange the default value.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-gis\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/#module-django.contrib.gis\" title=\"django.contrib.gis: Geographic Information System (GIS) extensions for Django\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.gis</code></a><a class=\"heading-anchor\" href=\"#django-contrib-gis\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>A new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/serializers/\"><span class=\"doc\">GeoJSON serializer</span></a> is now\navailable.</p></li>\n<li><p>It is now allowed to include a subquery as a geographic lookup argument, for\nexample\n<code class=\"docutils literal notranslate\">City.objects.filter(point__within=Country.objects.filter(continent='Africa').values('mpoly'))</code>.</p></li>\n<li><p>The SpatiaLite backend now supports <code class=\"docutils literal notranslate\">Collect</code> and <code class=\"docutils literal notranslate\">Extent</code> aggregates\nwhen the database version is 3.0 or later.</p></li>\n<li><p>The PostGIS 2 <code class=\"docutils literal notranslate\">CREATE EXTENSION postgis</code> and the SpatiaLite\n<code class=\"docutils literal notranslate\">SELECT InitSpatialMetaData</code> initialization commands are now automatically\nrun by <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-migrate\"><code class=\"xref std std-djadmin docutils literal notranslate\">migrate</code></a>.</p></li>\n<li><p>The GDAL interface now supports retrieving properties of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/gdal/#raster-data-source-objects\"><span class=\"std std-ref\">raster (image) data file</span></a>.</p></li>\n<li><p>Compatibility shims for <code class=\"docutils literal notranslate\">SpatialRefSys</code> and <code class=\"docutils literal notranslate\">GeometryColumns</code> changed in\nDjango 1.2 have been removed.</p></li>\n<li><p>All GDAL-related exceptions are now raised with <code class=\"docutils literal notranslate\">GDALException</code>. The former\n<code class=\"docutils literal notranslate\">OGRException</code> has been kept for backwards compatibility but should not be\nused any longer.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-sessions\">\n<h4><a class=\"reference internal\" href=\"/en/dev/topics/http/sessions/#module-django.contrib.sessions\" title=\"django.contrib.sessions: Provides session management for Django projects.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.sessions</code></a><a class=\"heading-anchor\" href=\"#django-contrib-sessions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Session cookie is now deleted after\n<a class=\"reference internal\" href=\"/en/dev/topics/http/sessions/#django.contrib.sessions.backends.base.SessionBase.flush\" title=\"django.contrib.sessions.backends.base.SessionBase.flush\"><code class=\"xref py py-meth docutils literal notranslate\">flush()</code></a> is called.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-sitemaps\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/sitemaps/#module-django.contrib.sitemaps\" title=\"django.contrib.sitemaps: A framework for generating Google sitemap XML files.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.sitemaps</code></a><a class=\"heading-anchor\" href=\"#django-contrib-sitemaps\"><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/sitemaps/#django.contrib.sitemaps.Sitemap.i18n\" title=\"django.contrib.sitemaps.Sitemap.i18n\"><code class=\"xref py py-attr docutils literal notranslate\">Sitemap.i18n</code></a> attribute\nallows you to generate a sitemap based on the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LANGUAGES\"><code class=\"xref std std-setting docutils literal notranslate\">LANGUAGES</code></a> setting.</p></li>\n</ul>\n</section>\n<section id=\"django-contrib-sites\">\n<h4><a class=\"reference internal\" href=\"/en/dev/ref/contrib/sites/#module-django.contrib.sites\" title=\"django.contrib.sites: Lets you operate multiple websites from the same database and Django project\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.sites</code></a><a class=\"heading-anchor\" href=\"#django-contrib-sites\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/contrib/sites/#django.contrib.sites.shortcuts.get_current_site\" title=\"django.contrib.sites.shortcuts.get_current_site\"><code class=\"xref py py-func docutils literal notranslate\">get_current_site()</code></a> will now lookup\nthe current site based on <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.get_host\" title=\"django.http.HttpRequest.get_host\"><code class=\"xref py py-meth docutils literal notranslate\">request.get_host()</code></a> if the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-SITE_ID\"><code class=\"xref std std-setting docutils literal notranslate\">SITE_ID</code></a> setting is not\ndefined.</p></li>\n<li><p>The default <a class=\"reference internal\" href=\"/en/dev/ref/contrib/sites/#django.contrib.sites.models.Site\" title=\"django.contrib.sites.models.Site\"><code class=\"xref py py-class docutils literal notranslate\">Site</code></a> created when running\n<code class=\"docutils literal notranslate\">migrate</code> now respects the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-SITE_ID\"><code class=\"xref std std-setting docutils literal notranslate\">SITE_ID</code></a> setting (instead of always\nusing <code class=\"docutils literal notranslate\">pk=1</code>).</p></li>\n</ul>\n</section>\n<section id=\"cache\">\n<h4>Cache<a class=\"heading-anchor\" href=\"#cache\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">incr()</code> method of the\n<code class=\"docutils literal notranslate\">django.core.cache.backends.locmem.LocMemCache</code> backend is now thread-safe.</p></li>\n</ul>\n</section>\n<section id=\"cryptography\">\n<h4>Cryptography<a class=\"heading-anchor\" href=\"#cryptography\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">max_age</code> parameter of the\n<a class=\"reference internal\" href=\"/en/dev/topics/signing/#django.core.signing.TimestampSigner.unsign\" title=\"django.core.signing.TimestampSigner.unsign\"><code class=\"xref py py-meth docutils literal notranslate\">django.core.signing.TimestampSigner.unsign()</code></a> method now also accepts a\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\">datetime.timedelta</code></a> object.</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>The MySQL backend no longer strips microseconds from <code class=\"docutils literal notranslate\">datetime</code> values as\nMySQL 5.6.4 and up supports fractional seconds depending on the declaration\nof the datetime field (when <code class=\"docutils literal notranslate\">DATETIME</code> includes fractional precision\ngreater than 0). New datetime database columns created with Django 1.8 and\nMySQL 5.6.4 and up will support microseconds. See the <a class=\"reference internal\" href=\"/en/dev/ref/databases/#mysql-fractional-seconds\"><span class=\"std std-ref\">MySQL database\nnotes</span></a> for more details.</p></li>\n<li><p>The MySQL backend no longer creates explicit indexes for foreign keys when\nusing the InnoDB storage engine, as MySQL already creates them automatically.</p></li>\n<li><p>The Oracle backend no longer defines the <code class=\"docutils literal notranslate\">connection_persists_old_columns</code>\nfeature as <code class=\"docutils literal notranslate\">True</code>. Instead, Oracle will now include a cache busting clause\nwhen getting the description of a table.</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><a class=\"reference internal\" href=\"/en/dev/topics/email/#topic-email-backends\"><span class=\"std std-ref\">Email backends</span></a> now support the context manager\nprotocol for opening and closing connections.</p></li>\n<li><p>The SMTP email backend now supports <code class=\"docutils literal notranslate\">keyfile</code> and <code class=\"docutils literal notranslate\">certfile</code>\nauthentication with the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-EMAIL_SSL_CERTFILE\"><code class=\"xref std std-setting docutils literal notranslate\">EMAIL_SSL_CERTFILE</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-EMAIL_SSL_KEYFILE\"><code class=\"xref std std-setting docutils literal notranslate\">EMAIL_SSL_KEYFILE</code></a> settings.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/email/#topic-email-smtp-backend\"><span class=\"std std-ref\">SMTP EmailBackend</span></a> now supports\nsetting the <code class=\"docutils literal notranslate\">timeout</code> parameter with the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-EMAIL_TIMEOUT\"><code class=\"xref std std-setting docutils literal notranslate\">EMAIL_TIMEOUT</code></a> setting.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/email/#django.core.mail.EmailMessage\" title=\"django.core.mail.EmailMessage\"><code class=\"xref py py-class docutils literal notranslate\">EmailMessage</code></a> and <code class=\"docutils literal notranslate\">EmailMultiAlternatives</code> now\nsupport the <code class=\"docutils literal notranslate\">reply_to</code> parameter.</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><a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.get_available_name\" title=\"django.core.files.storage.Storage.get_available_name\"><code class=\"xref py py-meth docutils literal notranslate\">Storage.get_available_name()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.save\" title=\"django.core.files.storage.Storage.save\"><code class=\"xref py py-meth docutils literal notranslate\">Storage.save()</code></a>\nnow take a <code class=\"docutils literal notranslate\">max_length</code> argument to implement storage-level maximum\nfilename length constraints. Filenames exceeding this argument will get\ntruncated. This prevents a database error when appending a unique suffix to a\nlong filename that already exists on the storage. See the <a class=\"reference internal\" href=\"#storage-max-length-update\"><span class=\"std std-ref\">deprecation\nnote</span></a> about adding this argument to your custom\nstorage classes.</p></li>\n</ul>\n</section>\n<section id=\"forms\">\n<h4>Forms<a class=\"heading-anchor\" href=\"#forms\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Form widgets now render attributes with a value of <code class=\"docutils literal notranslate\">True</code> or <code class=\"docutils literal notranslate\">False</code>\nas HTML5 boolean attributes.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.has_error\" title=\"django.forms.Form.has_error\"><code class=\"xref py py-meth docutils literal notranslate\">has_error()</code></a> method allows checking\nif a specific error has happened.</p></li>\n<li><p>If <a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.required_css_class\" title=\"django.forms.Form.required_css_class\"><code class=\"xref py py-attr docutils literal notranslate\">required_css_class</code></a> is defined on a form, then\nthe <code class=\"docutils literal notranslate\">&lt;label&gt;</code> tags for required fields will have this class present in its\nattributes.</p></li>\n<li><p>The rendering of non-field errors in unordered lists (<code class=\"docutils literal notranslate\">&lt;ul&gt;</code>) now includes\n<code class=\"docutils literal notranslate\">nonfield</code> in its list of classes to distinguish them from field-specific\nerrors.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.Field\" title=\"django.forms.Field\"><code class=\"xref py py-class docutils literal notranslate\">Field</code></a> now accepts a\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.Field.label_suffix\" title=\"django.forms.Field.label_suffix\"><code class=\"xref py py-attr docutils literal notranslate\">label_suffix</code></a> argument, which will override the\nform’s <a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.label_suffix\" title=\"django.forms.Form.label_suffix\"><code class=\"xref py py-attr docutils literal notranslate\">label_suffix</code></a>. This enables customizing the\nsuffix on a per-field basis — previously it wasn’t possible to override\na form’s <a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.label_suffix\" title=\"django.forms.Form.label_suffix\"><code class=\"xref py py-attr docutils literal notranslate\">label_suffix</code></a> while using  shortcuts such\nas <code class=\"docutils literal notranslate\">{{ form.as_p }}</code> in templates.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.SelectDateWidget\" title=\"django.forms.SelectDateWidget\"><code class=\"xref py py-class docutils literal notranslate\">SelectDateWidget</code></a> now accepts an\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.SelectDateWidget.empty_label\" title=\"django.forms.SelectDateWidget.empty_label\"><code class=\"xref py py-attr docutils literal notranslate\">empty_label</code></a> argument, which will\noverride the top list choice label when <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.DateField\" title=\"django.forms.DateField\"><code class=\"xref py py-class docutils literal notranslate\">DateField</code></a>\nis not required.</p></li>\n<li><p>After an <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.ImageField\" title=\"django.forms.ImageField\"><code class=\"xref py py-class docutils literal notranslate\">ImageField</code></a> has been cleaned and validated,\nthe <code class=\"docutils literal notranslate\">UploadedFile</code> object will have an additional <code class=\"docutils literal notranslate\">image</code> attribute\ncontaining the Pillow <code class=\"docutils literal notranslate\">Image</code> instance used to check if the file was a\nvalid image. It will also update <code class=\"docutils literal notranslate\">UploadedFile.content_type</code> with the\nimage’s content type as determined by Pillow.</p></li>\n<li><p>You can now pass a callable that returns an iterable of choices when\ninstantiating a <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.ChoiceField\" title=\"django.forms.ChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">ChoiceField</code></a>.</p></li>\n</ul>\n</section>\n<section id=\"generic-views\">\n<h4>Generic Views<a class=\"heading-anchor\" href=\"#generic-views\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Generic views that use\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-multiple-object/#django.views.generic.list.MultipleObjectMixin\" title=\"django.views.generic.list.MultipleObjectMixin\"><code class=\"xref py py-class docutils literal notranslate\">MultipleObjectMixin</code></a> may now specify the\nordering applied to the\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-multiple-object/#django.views.generic.list.MultipleObjectMixin.queryset\" title=\"django.views.generic.list.MultipleObjectMixin.queryset\"><code class=\"xref py py-attr docutils literal notranslate\">queryset</code></a> by setting\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-multiple-object/#django.views.generic.list.MultipleObjectMixin.ordering\" title=\"django.views.generic.list.MultipleObjectMixin.ordering\"><code class=\"xref py py-attr docutils literal notranslate\">ordering</code></a> or overriding\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-multiple-object/#django.views.generic.list.MultipleObjectMixin.get_ordering\" title=\"django.views.generic.list.MultipleObjectMixin.get_ordering\"><code class=\"xref py py-meth docutils literal notranslate\">get_ordering()</code></a>.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-single-object/#django.views.generic.detail.SingleObjectMixin.query_pk_and_slug\" title=\"django.views.generic.detail.SingleObjectMixin.query_pk_and_slug\"><code class=\"xref py py-attr docutils literal notranslate\">SingleObjectMixin.query_pk_and_slug</code></a>\nattribute allows changing the behavior of\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-single-object/#django.views.generic.detail.SingleObjectMixin.get_object\" title=\"django.views.generic.detail.SingleObjectMixin.get_object\"><code class=\"xref py py-meth docutils literal notranslate\">get_object()</code></a>\nso that it’ll perform its lookup using both the primary key and the slug.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-editing/#django.views.generic.edit.FormMixin.get_form\" title=\"django.views.generic.edit.FormMixin.get_form\"><code class=\"xref py py-meth docutils literal notranslate\">get_form()</code></a> method doesn’t\nrequire a <code class=\"docutils literal notranslate\">form_class</code> to be provided anymore. If not provided\n<code class=\"docutils literal notranslate\">form_class</code> defaults to\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-editing/#django.views.generic.edit.FormMixin.get_form_class\" title=\"django.views.generic.edit.FormMixin.get_form_class\"><code class=\"xref py py-meth docutils literal notranslate\">get_form_class()</code></a>.</p></li>\n<li><p>Placeholders in <a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-editing/#django.views.generic.edit.ModelFormMixin.success_url\" title=\"django.views.generic.edit.ModelFormMixin.success_url\"><code class=\"xref py py-attr docutils literal notranslate\">ModelFormMixin.success_url</code></a> now support the\nPython <a class=\"reference external\" href=\"https://docs.python.org/3/library/stdtypes.html#str.format\" title=\"(in Python v3.14)\"><code class=\"xref py py-meth docutils literal notranslate\">str.format()</code></a> syntax. The legacy <code class=\"docutils literal notranslate\">%(&lt;foo&gt;)s</code> syntax is still\nsupported but will be removed in Django 1.10.</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><a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-FORMAT_MODULE_PATH\"><code class=\"xref std std-setting docutils literal notranslate\">FORMAT_MODULE_PATH</code></a> can now be a list of strings representing\nmodule paths. This allows importing several format modules from different\nreusable apps. It also allows overriding those custom formats in your main\nDjango project.</p></li>\n</ul>\n</section>\n<section id=\"logging\">\n<h4>Logging<a class=\"heading-anchor\" href=\"#logging\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/logging/#django.utils.log.AdminEmailHandler\" title=\"django.utils.log.AdminEmailHandler\"><code class=\"xref py py-class docutils literal notranslate\">django.utils.log.AdminEmailHandler</code></a> class now has a\n<a class=\"reference internal\" href=\"/en/dev/ref/logging/#django.utils.log.AdminEmailHandler.send_mail\" title=\"django.utils.log.AdminEmailHandler.send_mail\"><code class=\"xref py py-meth docutils literal notranslate\">send_mail()</code></a> method to make it more\nsubclass friendly.</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>Database connections are now always closed after a management command called\nfrom the command line has finished doing its job.</p></li>\n<li><p>Commands from alternate package formats like eggs are now also discovered.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-dumpdata-output\"><code class=\"xref std std-option docutils literal notranslate\">dumpdata --output</code></a> option allows specifying a file to which\nthe serialized data is written.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-makemessages-exclude\"><code class=\"xref std std-option docutils literal notranslate\">makemessages --exclude</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-compilemessages-exclude\"><code class=\"xref std std-option docutils literal notranslate\">compilemessages\n--exclude</code></a> options allow excluding specific locales from processing.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-compilemessages\"><code class=\"xref std std-djadmin docutils literal notranslate\">compilemessages</code></a> now has a <code class=\"docutils literal notranslate\">--use-fuzzy</code> or <code class=\"docutils literal notranslate\">-f</code> option which\nincludes fuzzy translations into compiled files.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-loaddata-ignorenonexistent\"><code class=\"xref std std-option docutils literal notranslate\">loaddata --ignorenonexistent</code></a> option now ignores data for models\nthat no longer exist.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-runserver\"><code class=\"xref std std-djadmin docutils literal notranslate\">runserver</code></a> now uses daemon threads for faster reloading.</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> now outputs <code class=\"docutils literal notranslate\">Meta.unique_together</code>. It is also able to\nintrospect <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.AutoField\" title=\"django.db.models.AutoField\"><code class=\"xref py py-class docutils literal notranslate\">AutoField</code></a> for MySQL and PostgreSQL\ndatabases.</p></li>\n<li><p>When calling management commands with options using\n<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django.core.management.call_command\" title=\"django.core.management.call_command\"><code class=\"xref py py-func docutils literal notranslate\">call_command()</code></a>, the option name can match the\ncommand line option name (without the initial dashes) or the final option\ndestination variable name, but in either case, the resulting option received\nby the command is now always the <code class=\"docutils literal notranslate\">dest</code> name specified in the command\noption definition (as long as the command uses the <a class=\"reference external\" href=\"https://docs.python.org/3/library/argparse.html#module-argparse\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">argparse</code></a> module).</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-dbshell\"><code class=\"xref std std-djadmin docutils literal notranslate\">dbshell</code></a> command now supports MySQL’s optional SSL certificate\nauthority setting (<code class=\"docutils literal notranslate\">--ssl-ca</code>).</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-makemigrations-name\"><code class=\"xref std std-option docutils literal notranslate\">makemigrations --name</code></a> allows giving the migration(s) a\ncustom name instead of a generated one.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-loaddata\"><code class=\"xref std std-djadmin docutils literal notranslate\">loaddata</code></a> command now prevents repeated fixture loading. If\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-FIXTURE_DIRS\"><code class=\"xref std std-setting docutils literal notranslate\">FIXTURE_DIRS</code></a> contains duplicates or a default fixture directory\npath (<code class=\"docutils literal notranslate\">app_name/fixtures</code>), an exception is raised.</p></li>\n<li><p>The new <code class=\"docutils literal notranslate\">makemigrations --exit</code> option allows exiting with an error\ncode if no migrations are created.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-showmigrations\"><code class=\"xref std std-djadmin docutils literal notranslate\">showmigrations</code></a> command allows listing all migrations and\ntheir dependencies in a project.</p></li>\n</ul>\n</section>\n<section id=\"middleware\">\n<h4>Middleware<a class=\"heading-anchor\" href=\"#middleware\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.common.CommonMiddleware.response_redirect_class\" title=\"django.middleware.common.CommonMiddleware.response_redirect_class\"><code class=\"xref py py-attr docutils literal notranslate\">CommonMiddleware.response_redirect_class</code></a>\nattribute allows you to customize the redirects issued by the middleware.</p></li>\n<li><p>A debug message will be logged to the <code class=\"docutils literal notranslate\">django.request</code> logger when a\nmiddleware raises a <a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.core.exceptions.MiddlewareNotUsed\" title=\"django.core.exceptions.MiddlewareNotUsed\"><code class=\"xref py py-exc docutils literal notranslate\">MiddlewareNotUsed</code></a>\nexception in <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\">DEBUG</code></a> mode.</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>The <a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunSQL\" title=\"django.db.migrations.operations.RunSQL\"><code class=\"xref py py-class docutils literal notranslate\">RunSQL</code></a> operation can now handle\nparameters passed to the SQL statements.</p></li>\n<li><p>It is now possible to have migrations (most probably <a class=\"reference internal\" href=\"/en/dev/topics/migrations/#data-migrations\"><span class=\"std std-ref\">data migrations</span></a>) for applications without models.</p></li>\n<li><p>Migrations can now <a class=\"reference internal\" href=\"/en/dev/topics/migrations/#using-managers-in-migrations\"><span class=\"std std-ref\">serialize model managers</span></a> as part of the model state.</p></li>\n<li><p>A <a class=\"reference internal\" href=\"/en/dev/topics/migrations/#migrations-removing-model-fields\"><span class=\"std std-ref\">generic mechanism to handle the deprecation of model fields</span></a> was added.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunPython.noop\" title=\"django.db.migrations.operations.RunPython.noop\"><code class=\"xref py py-meth docutils literal notranslate\">RunPython.noop()</code></a>\nand <a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunSQL.noop\" title=\"django.db.migrations.operations.RunSQL.noop\"><code class=\"xref py py-attr docutils literal notranslate\">RunSQL.noop</code></a> class\nmethod/attribute were added to ease in making <code class=\"docutils literal notranslate\">RunPython</code> and <code class=\"docutils literal notranslate\">RunSQL</code>\noperations reversible.</p></li>\n<li><p>The migration operations <a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunPython\" title=\"django.db.migrations.operations.RunPython\"><code class=\"xref py py-class docutils literal notranslate\">RunPython</code></a>\nand <a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunSQL\" title=\"django.db.migrations.operations.RunSQL\"><code class=\"xref py py-class docutils literal notranslate\">RunSQL</code></a> now call the\n<a class=\"reference internal\" href=\"/en/dev/topics/db/multi-db/#allow_migrate\" title=\"allow_migrate\"><code class=\"xref py py-meth docutils literal notranslate\">allow_migrate()</code></a> method of database routers. The router can use the\nnewly introduced <code class=\"docutils literal notranslate\">app_label</code> and <code class=\"docutils literal notranslate\">hints</code> arguments to make a routing\ndecision. To take advantage of this feature you need to update the router to\nthe new <code class=\"docutils literal notranslate\">allow_migrate</code> signature, see the <a class=\"reference internal\" href=\"#deprecated-signature-of-allow-migrate\"><span class=\"std std-ref\">deprecation section</span></a> for more details.</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>Django now logs at most 9000 queries in <code class=\"docutils literal notranslate\">connections.queries</code>, in order\nto prevent excessive memory usage in long-running processes in debug mode.</p></li>\n<li><p>There is now a model <code class=\"docutils literal notranslate\">Meta</code> option to define a\n<a class=\"reference internal\" href=\"/en/dev/ref/models/options/#django.db.models.Options.default_related_name\" title=\"django.db.models.Options.default_related_name\"><code class=\"xref py py-attr docutils literal notranslate\">default related name</code></a>\nfor all relational fields of a model.</p></li>\n<li><p>Pickling models and querysets across different versions of Django isn’t\nofficially supported (it may work, but there’s no guarantee). An extra\nvariable that specifies the current Django version is now added to the\npickled state of models and querysets, and Django raises a <code class=\"docutils literal notranslate\">RuntimeWarning</code>\nwhen these objects are unpickled in a different version than the one in\nwhich they were pickled.</p></li>\n<li><p>Added <a class=\"reference internal\" href=\"/en/dev/ref/models/instances/#django.db.models.Model.from_db\" title=\"django.db.models.Model.from_db\"><code class=\"xref py py-meth docutils literal notranslate\">Model.from_db()</code></a> which\nDjango uses whenever objects are loaded using the ORM. The method allows\ncustomizing model loading behavior.</p></li>\n<li><p><code class=\"docutils literal notranslate\">extra(select={...})</code> now allows you to escape a literal <code class=\"docutils literal notranslate\">%s</code> sequence\nusing <code class=\"docutils literal notranslate\">%%s</code>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/howto/custom-lookups/\"><span class=\"doc\">Custom Lookups</span></a> can now be registered using\na decorator pattern.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/models/lookups/#django.db.models.Transform.bilateral\" title=\"django.db.models.Transform.bilateral\"><code class=\"xref py py-attr docutils literal notranslate\">Transform.bilateral</code></a>\nattribute allows creating bilateral transformations. These transformations\nare applied to both <code class=\"docutils literal notranslate\">lhs</code> and <code class=\"docutils literal notranslate\">rhs</code> when used in a lookup expression,\nproviding opportunities for more sophisticated lookups.</p></li>\n<li><p>SQL special characters (, %, _) are now escaped properly when a pattern\nlookup (e.g. <code class=\"docutils literal notranslate\">contains</code>, <code class=\"docutils literal notranslate\">startswith</code>, etc.) is used with an <code class=\"docutils literal notranslate\">F()</code>\nexpression as the right-hand side. In those cases, the escaping is performed\nby the database, which can lead to somewhat complex queries involving nested\n<code class=\"docutils literal notranslate\">REPLACE</code> function calls.</p></li>\n<li><p>You can now refresh model instances by using <a class=\"reference internal\" href=\"/en/dev/ref/models/instances/#django.db.models.Model.refresh_from_db\" title=\"django.db.models.Model.refresh_from_db\"><code class=\"xref py py-meth docutils literal notranslate\">Model.refresh_from_db()</code></a>.</p></li>\n<li><p>You can now get the set of deferred fields for a model using\n<a class=\"reference internal\" href=\"/en/dev/ref/models/instances/#django.db.models.Model.get_deferred_fields\" title=\"django.db.models.Model.get_deferred_fields\"><code class=\"xref py py-meth docutils literal notranslate\">Model.get_deferred_fields()</code></a>.</p></li>\n<li><p>Model field <code class=\"docutils literal notranslate\">default</code>’s are now used when primary key field’s are set to\n<code class=\"docutils literal notranslate\">None</code>.</p></li>\n</ul>\n</section>\n<section id=\"signals\">\n<h4>Signals<a class=\"heading-anchor\" href=\"#signals\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p>Exceptions from the <code class=\"docutils literal notranslate\">(receiver, exception)</code> tuples returned by\n<a class=\"reference internal\" href=\"/en/dev/topics/signals/#django.dispatch.Signal.send_robust\" title=\"django.dispatch.Signal.send_robust\"><code class=\"xref py py-meth docutils literal notranslate\">Signal.send_robust()</code></a> now have\ntheir traceback attached as a <code class=\"docutils literal notranslate\">__traceback__</code> attribute.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">environ</code> argument, which contains the WSGI environment structure from\nthe request, was added to the <a class=\"reference internal\" href=\"/en/dev/ref/signals/#django.core.signals.request_started\" title=\"django.core.signals.request_started\"><code class=\"xref py py-data docutils literal notranslate\">request_started</code></a>\nsignal.</p></li>\n<li><p>You can now import the <a class=\"reference internal\" href=\"/en/dev/ref/signals/#django.test.signals.setting_changed\" title=\"django.test.signals.setting_changed\"><code class=\"xref py py-func docutils literal notranslate\">setting_changed()</code></a> signal\nfrom <code class=\"docutils literal notranslate\">django.core.signals</code> to avoid loading <code class=\"docutils literal notranslate\">django.test</code> in non-test\nsituations. Django no longer does so itself.</p></li>\n</ul>\n</section>\n<section id=\"system-check-framework\">\n<h4>System Check Framework<a class=\"heading-anchor\" href=\"#system-check-framework\"><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/topics/checks/#django.core.checks.register\" title=\"django.core.checks.register\"><code class=\"xref py py-attr docutils literal notranslate\">register</code></a> can now be used as a function.</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/templates/builtins/#std-templatefilter-urlize\"><code class=\"xref std std-tfilter docutils literal notranslate\">urlize</code></a> now supports domain-only links that include characters\nafter the top-level domain (e.g. <code class=\"docutils literal notranslate\">djangoproject.com/</code> and\n<code class=\"docutils literal notranslate\">djangoproject.com/download/</code>).</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-urlize\"><code class=\"xref std std-tfilter docutils literal notranslate\">urlize</code></a> doesn’t treat exclamation marks at the end of a domain or\nits query string as part of the URL (the URL in e.g. <code class=\"docutils literal notranslate\">'djangoproject.com!</code>\nis <code class=\"docutils literal notranslate\">djangoproject.com</code>)</p></li>\n<li><p>Added a <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.loaders.locmem.Loader\" title=\"django.template.loaders.locmem.Loader\"><code class=\"xref py py-class docutils literal notranslate\">locmem.Loader</code></a>\nclass that loads Django templates from a Python dictionary.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-now\"><code class=\"xref std std-ttag docutils literal notranslate\">now</code></a> tag can now store its output in a context variable with the\nusual syntax: <code class=\"docutils literal notranslate\">{% now 'j n Y' as varname %}</code>.</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><code class=\"docutils literal notranslate\">WSGIRequest</code> now respects paths starting with <code class=\"docutils literal notranslate\">//</code>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.build_absolute_uri\" title=\"django.http.HttpRequest.build_absolute_uri\"><code class=\"xref py py-meth docutils literal notranslate\">HttpRequest.build_absolute_uri()</code></a> method now handles paths\nstarting with <code class=\"docutils literal notranslate\">//</code> correctly.</p></li>\n<li><p>If <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\">DEBUG</code></a> is <code class=\"docutils literal notranslate\">True</code> and a request raises a\n<a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.core.exceptions.SuspiciousOperation\" title=\"django.core.exceptions.SuspiciousOperation\"><code class=\"xref py py-exc docutils literal notranslate\">SuspiciousOperation</code></a>, the response will be\nrendered with a detailed error page.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">query_string</code> argument of <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.QueryDict\" title=\"django.http.QueryDict\"><code class=\"xref py py-class docutils literal notranslate\">QueryDict</code></a> is now\noptional, defaulting to <code class=\"docutils literal notranslate\">None</code>, so a blank <code class=\"docutils literal notranslate\">QueryDict</code> can now be\ninstantiated with <code class=\"docutils literal notranslate\">QueryDict()</code> instead of <code class=\"docutils literal notranslate\">QueryDict(None)</code> or\n<code class=\"docutils literal notranslate\">QueryDict('')</code>.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">GET</code> and <code class=\"docutils literal notranslate\">POST</code> attributes of an <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest\" title=\"django.http.HttpRequest\"><code class=\"xref py py-class docutils literal notranslate\">HttpRequest</code></a>\nobject are now <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.QueryDict\" title=\"django.http.QueryDict\"><code class=\"xref py py-class docutils literal notranslate\">QueryDict</code></a>s rather than dictionaries,\nand the <code class=\"docutils literal notranslate\">FILES</code> attribute is now a <code class=\"docutils literal notranslate\">MultiValueDict</code>.\nThis brings this class into line with the documentation and with\n<code class=\"docutils literal notranslate\">WSGIRequest</code>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse.charset\" title=\"django.http.HttpResponse.charset\"><code class=\"xref py py-attr docutils literal notranslate\">HttpResponse.charset</code></a> attribute\nwas added.</p></li>\n<li><p><code class=\"docutils literal notranslate\">WSGIRequestHandler</code> now follows RFC in converting URI to IRI, using\n<code class=\"docutils literal notranslate\">uri_to_iri()</code>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.get_full_path\" title=\"django.http.HttpRequest.get_full_path\"><code class=\"xref py py-meth docutils literal notranslate\">HttpRequest.get_full_path()</code></a> method now escapes unsafe characters\nfrom the path portion of a Uniform Resource Identifier (URI) properly.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a> now implements a few additional methods\nlike <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse.getvalue\" title=\"django.http.HttpResponse.getvalue\"><code class=\"xref py py-meth docutils literal notranslate\">getvalue()</code></a> so that instances can be used\nas stream objects.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse.setdefault\" title=\"django.http.HttpResponse.setdefault\"><code class=\"xref py py-meth docutils literal notranslate\">HttpResponse.setdefault()</code></a> method allows setting a header unless\nit has already been set.</p></li>\n<li><p>You can use the new <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.FileResponse\" title=\"django.http.FileResponse\"><code class=\"xref py py-class docutils literal notranslate\">FileResponse</code></a> to stream files.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/http/decorators/#django.views.decorators.http.condition\" title=\"django.views.decorators.http.condition\"><code class=\"xref py py-func docutils literal notranslate\">condition()</code></a> decorator for\nconditional view processing now supports the <code class=\"docutils literal notranslate\">If-unmodified-since</code> header.</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>The <a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.RequestFactory\" title=\"django.test.RequestFactory\"><code class=\"xref py py-class docutils literal notranslate\">RequestFactory.trace()</code></a>\nand <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.Client.trace\" title=\"django.test.Client.trace\"><code class=\"xref py py-class docutils literal notranslate\">Client.trace()</code></a> methods were\nimplemented, allowing you to create <code class=\"docutils literal notranslate\">TRACE</code> requests in your tests.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">count</code> argument was added to\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed\" title=\"django.test.SimpleTestCase.assertTemplateUsed\"><code class=\"xref py py-meth docutils literal notranslate\">assertTemplateUsed()</code></a>. This allows you to\nassert that a template was rendered a specific number of times.</p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertJSONNotEqual\" title=\"django.test.SimpleTestCase.assertJSONNotEqual\"><code class=\"xref py py-meth docutils literal notranslate\">assertJSONNotEqual()</code></a> assertion\nallows you to test that two JSON fragments are not equal.</p></li>\n<li><p>Added options to the <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-test\"><code class=\"xref std std-djadmin docutils literal notranslate\">test</code></a> command to preserve the test database\n(<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-test-keepdb\"><code class=\"xref std std-option docutils literal notranslate\">--keepdb</code></a>), to run the test cases in reverse order\n(<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-test-reverse\"><code class=\"xref std std-option docutils literal notranslate\">--reverse</code></a>), and to enable SQL logging for failing\ntests (<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-test-debug-sql\"><code class=\"xref std std-option docutils literal notranslate\">--debug-sql</code></a>).</p></li>\n<li><p>Added the <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.Response.resolver_match\" title=\"django.test.Response.resolver_match\"><code class=\"xref py py-attr docutils literal notranslate\">resolver_match</code></a> attribute to test\nclient responses.</p></li>\n<li><p>Added several settings that allow customization of test tablespace parameters\nfor Oracle: <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATAFILE\"><code class=\"xref std std-setting docutils literal notranslate\">DATAFILE</code></a>, <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATAFILE_TMP\"><code class=\"xref std std-setting docutils literal notranslate\">DATAFILE_TMP</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATAFILE_MAXSIZE\"><code class=\"xref std std-setting docutils literal notranslate\">DATAFILE_MAXSIZE</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATAFILE_TMP_MAXSIZE\"><code class=\"xref std std-setting docutils literal notranslate\">DATAFILE_TMP_MAXSIZE</code></a>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.override_settings\" title=\"django.test.override_settings\"><code class=\"xref py py-func docutils literal notranslate\">override_settings()</code></a> decorator can now affect the\nmaster router in <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DATABASE_ROUTERS\"><code class=\"xref std std-setting docutils literal notranslate\">DATABASE_ROUTERS</code></a>.</p></li>\n<li><p>Added test client support for file uploads with file-like objects.</p></li>\n<li><p>A shared cache is now used when testing with an SQLite in-memory database\nwhen using Python 3.4+ and SQLite 3.7.13+. This allows sharing the database\nbetween threads.</p></li>\n</ul>\n</section>\n<section id=\"validators\">\n<h4>Validators<a class=\"heading-anchor\" href=\"#validators\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.URLValidator\" title=\"django.core.validators.URLValidator\"><code class=\"xref py py-class docutils literal notranslate\">URLValidator</code></a> now supports IPv6 addresses,\nUnicode domains, and URLs containing authentication data.</p></li>\n</ul>\n</section>\n</section>\n</section>\n<section id=\"backwards-incompatible-changes-in-1-8\">\n<span id=\"backwards-incompatible-1-8\"></span><h2>Backwards incompatible changes in 1.8<a class=\"heading-anchor\" href=\"#backwards-incompatible-changes-in-1-8\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<aside class=\"admonition admonition-warning\" role=\"note\">\n<p class=\"admonition-title\">Warning</p>\n<p>In addition to the changes outlined in this section, be sure to review the\n<a class=\"reference internal\" href=\"/en/dev/internals/deprecation/#deprecation-removed-in-1-8\"><span class=\"std std-ref\">deprecation plan</span></a> for any features that\nhave been removed. If you haven’t updated your code within the\ndeprecation timeline for a given feature, its removal may appear as a\nbackwards incompatible change.</p>\n</aside>\n<section id=\"related-object-operations-are-run-in-a-transaction\">\n<h3>Related object operations are run in a transaction<a class=\"heading-anchor\" href=\"#related-object-operations-are-run-in-a-transaction\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Some operations on related objects such as\n<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\">add()</code></a> or direct\nassignment ran multiple data modifying queries without wrapping them in\ntransactions. To reduce the risk of data corruption, all data modifying methods\nthat affect multiple related objects (i.e. <code class=\"docutils literal notranslate\">add()</code>, <code class=\"docutils literal notranslate\">remove()</code>,\n<code class=\"docutils literal notranslate\">clear()</code>, and direct assignment) now perform their data modifying queries\nfrom within a transaction, provided your database supports transactions.</p>\n<p>This has one backwards incompatible side effect, signal handlers triggered from\nthese methods are now executed within the method’s transaction and any\nexception in a signal handler will prevent the whole operation.</p>\n</section>\n<section id=\"assigning-unsaved-objects-to-relations-raises-an-error\">\n<span id=\"unsaved-model-instance-check-18\"></span><h3>Assigning unsaved objects to relations raises an error<a class=\"heading-anchor\" href=\"#assigning-unsaved-objects-to-relations-raises-an-error\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>To more easily allow in-memory usage of models, this change was reverted in\nDjango 1.8.4 and replaced with a check during <code class=\"docutils literal notranslate\">model.save()</code>. For\nexample:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>book <span class=\"o\">=</span> Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>create<span class=\"p\">(</span>name<span class=\"o\">=</span><span class=\"s2\">&quot;Django&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>book<span class=\"o\">.</span>author <span class=\"o\">=</span> Author<span class=\"p\">(</span>name<span class=\"o\">=</span><span class=\"s2\">&quot;John&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>book<span class=\"o\">.</span>save<span class=\"p\">()</span>\n<span class=\"gt\">Traceback (most recent call last):</span>\n<span class=\"c\">...</span>\n<span class=\"gr\">ValueError</span>: save() prohibited to prevent data loss due to unsaved related object &#39;author&#39;.\n</code></pre></div>\n<p>A similar check on assignment to reverse one-to-one relations was removed\nin Django 1.8.5.</p>\n</aside>\n<p>Assigning unsaved objects to a <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ForeignKey\" title=\"django.db.models.ForeignKey\"><code class=\"xref py py-class docutils literal notranslate\">ForeignKey</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/contenttypes/#django.contrib.contenttypes.fields.GenericForeignKey\" title=\"django.contrib.contenttypes.fields.GenericForeignKey\"><code class=\"xref py py-class docutils literal notranslate\">GenericForeignKey</code></a>, and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.OneToOneField\" title=\"django.db.models.OneToOneField\"><code class=\"xref py py-class docutils literal notranslate\">OneToOneField</code></a> now raises a <a class=\"reference external\" href=\"https://docs.python.org/3/library/exceptions.html#ValueError\" title=\"(in Python v3.14)\"><code class=\"xref py py-exc docutils literal notranslate\">ValueError</code></a>.</p>\n<p>Previously, the assignment of an unsaved object would be silently ignored.\nFor example:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>book <span class=\"o\">=</span> Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>create<span class=\"p\">(</span>name<span class=\"o\">=</span><span class=\"s2\">&quot;Django&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>book<span class=\"o\">.</span>author <span class=\"o\">=</span> Author<span class=\"p\">(</span>name<span class=\"o\">=</span><span class=\"s2\">&quot;John&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>book<span class=\"o\">.</span>author<span class=\"o\">.</span>save<span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>book<span class=\"o\">.</span>save<span class=\"p\">()</span>\n\n<span class=\"gp\">&gt;&gt;&gt; </span>Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>get<span class=\"p\">(</span>name<span class=\"o\">=</span><span class=\"s2\">&quot;Django&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>book<span class=\"o\">.</span>author\n<span class=\"gp\">&gt;&gt;&gt;</span>\n</code></pre></div>\n<p>Now, an error will be raised to prevent data loss:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>book<span class=\"o\">.</span>author <span class=\"o\">=</span> Author<span class=\"p\">(</span>name<span class=\"o\">=</span><span class=\"s2\">&quot;john&quot;</span><span class=\"p\">)</span>\n<span class=\"gt\">Traceback (most recent call last):</span>\n<span class=\"c\">...</span>\n<span class=\"gr\">ValueError</span>: Cannot assign &quot;&lt;Author: John&gt;&quot;: &quot;Author&quot; instance isn&#39;t saved in the database.\n</code></pre></div>\n<p>If you require allowing the assignment of unsaved instances (the old behavior)\nand aren’t concerned about the data loss possibility (e.g. you never save the\nobjects to the database), you can disable this check by using the\n<code class=\"docutils literal notranslate\">ForeignKey.allow_unsaved_instance_assignment</code> attribute. (This attribute was\nremoved in 1.8.4 as it’s no longer relevant.)</p>\n</section>\n<section id=\"management-commands-that-only-accept-positional-arguments\">\n<h3>Management commands that only accept positional arguments<a class=\"heading-anchor\" href=\"#management-commands-that-only-accept-positional-arguments\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you have written a custom management command that only accepts positional\narguments and you didn’t specify the <code class=\"docutils literal notranslate\">args</code> command variable, you might get\nan error like <code class=\"docutils literal notranslate\">Error: unrecognized arguments: ...</code>, as variable parsing is\nnow based on <a class=\"reference external\" href=\"https://docs.python.org/3/library/argparse.html#module-argparse\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">argparse</code></a> which doesn’t implicitly accept positional\narguments. You can make your command backwards compatible by simply setting the\n<code class=\"docutils literal notranslate\">args</code> class variable. However, if you don’t have to keep compatibility with\nolder Django versions, it’s better to implement the new\n<a class=\"reference internal\" href=\"/en/dev/howto/custom-management-commands/#django.core.management.BaseCommand.add_arguments\" title=\"django.core.management.BaseCommand.add_arguments\"><code class=\"xref py py-meth docutils literal notranslate\">add_arguments()</code></a> method as described\nin <a class=\"reference internal\" href=\"/en/dev/howto/custom-management-commands/\"><span class=\"doc\">How to create custom django-admin commands</span></a>.</p>\n</section>\n<section id=\"custom-test-management-command-arguments-through-test-runner\">\n<h3>Custom test management command arguments through test runner<a class=\"heading-anchor\" href=\"#custom-test-management-command-arguments-through-test-runner\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The method to add custom arguments to the <code class=\"docutils literal notranslate\">test</code> management command through\nthe test runner has changed. Previously, you could provide an <code class=\"docutils literal notranslate\">option_list</code>\nclass variable on the test runner to add more arguments (à la\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/optparse.html#module-optparse\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">optparse</code></a>). Now to implement the same behavior, you have to create an\n<code class=\"docutils literal notranslate\">add_arguments(cls, parser)</code> class method on the test runner and call\n<code class=\"docutils literal notranslate\">parser.add_argument</code> to add any custom arguments, as parser is now an\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">argparse.ArgumentParser</code></a> instance.</p>\n</section>\n<section id=\"model-check-ensures-auto-generated-column-names-are-within-limits-specified-by-database\">\n<h3>Model check ensures auto-generated column names are within limits specified by database<a class=\"heading-anchor\" href=\"#model-check-ensures-auto-generated-column-names-are-within-limits-specified-by-database\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>A field name that’s longer than the column name length supported by a database\ncan create problems. For example, with MySQL you’ll get an exception trying to\ncreate the column, and with PostgreSQL the column name is truncated by the\ndatabase (you may see a warning in the PostgreSQL logs).</p>\n<p>A model check has been introduced to better alert users to this scenario before\nthe actual creation of database tables.</p>\n<p>If you have an existing model where this check seems to be a false positive,\nfor example on PostgreSQL where the name was already being truncated, simply\nuse <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.Field.db_column\" title=\"django.db.models.Field.db_column\"><code class=\"xref py py-attr docutils literal notranslate\">db_column</code></a> to specify the name that’s being\nused.</p>\n<p>The check also applies to the columns generated in an implicit\n<code class=\"docutils literal notranslate\">ManyToManyField.through</code> model. If you run into an issue there, use\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ManyToManyField.through\" title=\"django.db.models.ManyToManyField.through\"><code class=\"xref py py-attr docutils literal notranslate\">through</code></a> to create an explicit model\nand then specify <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.Field.db_column\" title=\"django.db.models.Field.db_column\"><code class=\"xref py py-attr docutils literal notranslate\">db_column</code></a> on its column(s)\nas needed.</p>\n</section>\n<section id=\"query-relation-lookups-now-check-object-types\">\n<h3>Query relation lookups now check object types<a class=\"heading-anchor\" href=\"#query-relation-lookups-now-check-object-types\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Querying for model lookups now checks if the object passed is of correct type\nand raises a <a class=\"reference external\" href=\"https://docs.python.org/3/library/exceptions.html#ValueError\" title=\"(in Python v3.14)\"><code class=\"xref py py-exc docutils literal notranslate\">ValueError</code></a> if not. Previously, Django didn’t care if the\nobject was of correct type; it just used the object’s related field attribute\n(e.g. <code class=\"docutils literal notranslate\">id</code>) for the lookup. Now, an error is raised to prevent incorrect\nlookups:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>book <span class=\"o\">=</span> Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>create<span class=\"p\">(</span>name<span class=\"o\">=</span><span class=\"s2\">&quot;Django&quot;</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>book <span class=\"o\">=</span> Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>filter<span class=\"p\">(</span>author<span class=\"o\">=</span>book<span class=\"p\">)</span>\n<span class=\"gt\">Traceback (most recent call last):</span>\n<span class=\"c\">...</span>\n<span class=\"gr\">ValueError</span>: Cannot query &quot;&lt;Book: Django&gt;&quot;: Must be &quot;Author&quot; instance.\n</code></pre></div>\n</section>\n<section id=\"select-related-now-checks-given-fields\">\n<h3><code class=\"docutils literal notranslate\">select_related()</code> now checks given fields<a class=\"heading-anchor\" href=\"#select-related-now-checks-given-fields\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">select_related()</code> now validates that the given fields actually exist.\nPreviously, nonexistent fields were silently ignored. Now, an error is raised:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>book <span class=\"o\">=</span> Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>select_related<span class=\"p\">(</span><span class=\"s2\">&quot;nonexistent_field&quot;</span><span class=\"p\">)</span>\n<span class=\"gt\">Traceback (most recent call last):</span>\n<span class=\"c\">...</span>\n<span class=\"gr\">FieldError</span>: Invalid field name(s) given in select_related: &#39;nonexistent_field&#39;\n</code></pre></div>\n<p>The validation also makes sure that the given field is relational:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>book <span class=\"o\">=</span> Book<span class=\"o\">.</span>objects<span class=\"o\">.</span>select_related<span class=\"p\">(</span><span class=\"s2\">&quot;name&quot;</span><span class=\"p\">)</span>\n<span class=\"gt\">Traceback (most recent call last):</span>\n<span class=\"c\">...</span>\n<span class=\"gr\">FieldError</span>: Non-relational field given in select_related: &#39;name&#39;\n</code></pre></div>\n</section>\n<section id=\"default-emailfield-max-length-increased-to-254\">\n<h3>Default <code class=\"docutils literal notranslate\">EmailField.max_length</code> increased to 254<a class=\"heading-anchor\" href=\"#default-emailfield-max-length-increased-to-254\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The old default 75 character <code class=\"docutils literal notranslate\">max_length</code> was not capable of storing all\npossible RFC3696/5321-compliant email addresses. In order to store all\npossible valid email addresses, the <code class=\"docutils literal notranslate\">max_length</code> has been increased to 254\ncharacters. You will need to generate and apply database migrations for your\naffected models (or add <code class=\"docutils literal notranslate\">max_length=75</code> if you wish to keep the length on\nyour current fields). A migration for\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.User.email\" title=\"django.contrib.auth.models.User.email\"><code class=\"xref py py-attr docutils literal notranslate\">django.contrib.auth.models.User.email</code></a> is included.</p>\n</section>\n<section id=\"support-for-postgresql-versions-older-than-9-0\">\n<h3>Support for PostgreSQL versions older than 9.0<a class=\"heading-anchor\" href=\"#support-for-postgresql-versions-older-than-9-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The end of upstream support periods was reached in July 2014 for PostgreSQL\n8.4. As a consequence, Django 1.8 sets 9.0 as the minimum PostgreSQL version it\nofficially supports.</p>\n<p>This also includes dropping support for PostGIS 1.3 and 1.4 as these versions\nare not supported on versions of PostgreSQL later than 8.4.</p>\n<p>Django also now requires the use of Psycopg2 version 2.4.5 or higher (or 2.5+\nif you want to use <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>).</p>\n</section>\n<section id=\"support-for-mysql-versions-older-than-5-5\">\n<h3>Support for MySQL versions older than 5.5<a class=\"heading-anchor\" href=\"#support-for-mysql-versions-older-than-5-5\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The end of upstream support periods was reached in January 2012 for MySQL 5.0\nand December 2013 for MySQL 5.1. As a consequence, Django 1.8 sets 5.5 as the\nminimum MySQL version it officially supports.</p>\n</section>\n<section id=\"support-for-oracle-versions-older-than-11-1\">\n<h3>Support for Oracle versions older than 11.1<a class=\"heading-anchor\" href=\"#support-for-oracle-versions-older-than-11-1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The end of upstream support periods was reached in July 2010 for Oracle 9.2,\nJanuary 2012 for Oracle 10.1, and July 2013 for Oracle 10.2. As a consequence,\nDjango 1.8 sets 11.1 as the minimum Oracle version it officially supports.</p>\n</section>\n<section id=\"specific-privileges-used-instead-of-roles-for-tests-on-oracle\">\n<h3>Specific privileges used instead of roles for tests on Oracle<a class=\"heading-anchor\" href=\"#specific-privileges-used-instead-of-roles-for-tests-on-oracle\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Earlier versions of Django granted the CONNECT and RESOURCE roles to the test\nuser on Oracle. These roles have been deprecated, so Django 1.8 uses the\nspecific underlying privileges instead. This changes the privileges required\nof the main user for running tests (unless the project is configured to avoid\ncreating a test user). The exact privileges required now are detailed in\n<a class=\"reference internal\" href=\"/en/dev/ref/databases/#oracle-notes\"><span class=\"std std-ref\">Oracle notes</span></a>.</p>\n</section>\n<section id=\"abstractuser-last-login-allows-null-values\">\n<h3><code class=\"docutils literal notranslate\">AbstractUser.last_login</code> allows null values<a class=\"heading-anchor\" href=\"#abstractuser-last-login-allows-null-values\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.User.last_login\" title=\"django.contrib.auth.models.User.last_login\"><code class=\"xref py py-attr docutils literal notranslate\">AbstractUser.last_login</code></a> field now allows null values.\nPreviously, it defaulted to the time when the user was created which was\nmisleading if the user never logged in. If you are using the default user\n(<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.models.User\" title=\"django.contrib.auth.models.User\"><code class=\"xref py py-class docutils literal notranslate\">django.contrib.auth.models.User</code></a>), run the database migration included\nin <code class=\"docutils literal notranslate\">contrib.auth</code>.</p>\n<p>If you are using a custom user model that inherits from <code class=\"docutils literal notranslate\">AbstractUser</code>,\nyou’ll need to run <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-makemigrations\"><code class=\"xref std std-djadmin docutils literal notranslate\">makemigrations</code></a> and generate a migration for your\napp that contains that model. Also, if wish to set <code class=\"docutils literal notranslate\">last_login</code> to <code class=\"docutils literal notranslate\">NULL</code>\nfor users who haven’t logged in, you can run this query:</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.contrib.auth</span> <span class=\"kn\">import</span> get_user_model\n<span class=\"kn\">from</span> <span class=\"nn\">django.contrib.auth.models</span> <span class=\"kn\">import</span> AbstractBaseUser\n\nUserModel <span class=\"o\">=</span> get_user_model<span class=\"p\">()</span>\n<span class=\"k\">if</span> <span class=\"nb\">issubclass</span><span class=\"p\">(</span>UserModel<span class=\"p\">,</span> AbstractBaseUser<span class=\"p\">):</span>\n    UserModel<span class=\"o\">.</span>_default_manager<span class=\"o\">.</span>filter<span class=\"p\">(</span>last_login<span class=\"o\">=</span>models<span class=\"o\">.</span>F<span class=\"p\">(</span><span class=\"s2\">&quot;date_joined&quot;</span><span class=\"p\">))</span><span class=\"o\">.</span>update<span class=\"p\">(</span>\n        last_login<span class=\"o\">=</span><span class=\"kc\">None</span>\n    <span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"id1\">\n<h3><a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/#module-django.contrib.gis\" title=\"django.contrib.gis: Geographic Information System (GIS) extensions for Django\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.gis</code></a><a class=\"heading-anchor\" href=\"#id1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>Support for GEOS 3.1 and GDAL 1.6 has been dropped.</p></li>\n<li><p>Support for SpatiaLite &lt; 2.4 has been dropped.</p></li>\n<li><p>GIS-specific lookups have been refactored to use the\n<a class=\"reference internal\" href=\"/en/dev/ref/models/lookups/#django.db.models.Lookup\" title=\"django.db.models.Lookup\"><code class=\"xref py py-class docutils literal notranslate\">django.db.models.Lookup</code></a> API.</p></li>\n<li><p>The default <code class=\"docutils literal notranslate\">str</code> representation of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry\" title=\"django.contrib.gis.geos.GEOSGeometry\"><code class=\"xref py py-class docutils literal notranslate\">GEOSGeometry</code></a> objects has been changed from\nWKT to EWKT format (including the SRID). As this representation is used in\nthe serialization framework, that means that <code class=\"docutils literal notranslate\">dumpdata</code> output will now\ncontain the SRID value of geometry objects.</p></li>\n</ul>\n</section>\n<section id=\"priority-of-context-processors-for-templateresponse-brought-in-line-with-render\">\n<h3>Priority of context processors for <code class=\"docutils literal notranslate\">TemplateResponse</code> brought in line with <code class=\"docutils literal notranslate\">render</code><a class=\"heading-anchor\" href=\"#priority-of-context-processors-for-templateresponse-brought-in-line-with-render\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <a class=\"reference internal\" href=\"/en/dev/ref/template-response/#django.template.response.TemplateResponse\" title=\"django.template.response.TemplateResponse\"><code class=\"xref py py-class docutils literal notranslate\">TemplateResponse</code></a> constructor is designed\nto be a drop-in replacement for the <a class=\"reference internal\" href=\"/en/dev/topics/http/shortcuts/#django.shortcuts.render\" title=\"django.shortcuts.render\"><code class=\"xref py py-func docutils literal notranslate\">render()</code></a> function.\nHowever, it had a slight incompatibility, in that for <code class=\"docutils literal notranslate\">TemplateResponse</code>,\ncontext data from the passed in context dictionary could be shadowed by context\ndata returned from context processors, whereas for <code class=\"docutils literal notranslate\">render</code> it was the other\nway around. This was a bug, and the behavior of <code class=\"docutils literal notranslate\">render</code> is more appropriate,\nsince it allows the globally defined context processors to be overridden\nlocally in the view. If you were relying on the fact context data in a\n<code class=\"docutils literal notranslate\">TemplateResponse</code> could be overridden using a context processor, you will\nneed to change your code.</p>\n</section>\n<section id=\"overriding-setupclass-teardownclass-in-test-cases\">\n<h3>Overriding <code class=\"docutils literal notranslate\">setUpClass</code> / <code class=\"docutils literal notranslate\">tearDownClass</code> in test cases<a class=\"heading-anchor\" href=\"#overriding-setupclass-teardownclass-in-test-cases\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The decorators <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.override_settings\" title=\"django.test.override_settings\"><code class=\"xref py py-func docutils literal notranslate\">override_settings()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.modify_settings\" title=\"django.test.modify_settings\"><code class=\"xref py py-func docutils literal notranslate\">modify_settings()</code></a> now act at the class level when used as\nclass decorators. As a consequence, when overriding <code class=\"docutils literal notranslate\">setUpClass()</code> or\n<code class=\"docutils literal notranslate\">tearDownClass()</code>, the <code class=\"docutils literal notranslate\">super</code> implementation should always be called.</p>\n</section>\n<section id=\"removal-of-django-contrib-formtools\">\n<h3>Removal of <code class=\"docutils literal notranslate\">django.contrib.formtools</code><a class=\"heading-anchor\" href=\"#removal-of-django-contrib-formtools\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The formtools contrib app has been moved to a separate package and the\nrelevant documentation pages have been updated or removed.</p>\n<p>The new package is available <a class=\"reference external\" href=\"https://github.com/jazzband/django-formtools/\">on GitHub</a> and on PyPI.</p>\n</section>\n<section id=\"database-connection-reloading-between-tests\">\n<h3>Database connection reloading between tests<a class=\"heading-anchor\" href=\"#database-connection-reloading-between-tests\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django previously closed database connections between each test within a\n<code class=\"docutils literal notranslate\">TestCase</code>. This is no longer the case as Django now wraps the whole\n<code class=\"docutils literal notranslate\">TestCase</code> within a transaction. If some of your tests relied on the old\nbehavior, you should have them inherit from <code class=\"docutils literal notranslate\">TransactionTestCase</code> instead.</p>\n</section>\n<section id=\"cleanup-of-the-django-template-namespace\">\n<h3>Cleanup of the <code class=\"docutils literal notranslate\">django.template</code> namespace<a class=\"heading-anchor\" href=\"#cleanup-of-the-django-template-namespace\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you’ve been relying on private APIs exposed in the <code class=\"docutils literal notranslate\">django.template</code>\nmodule, you may have to import them from <code class=\"docutils literal notranslate\">django.template.base</code> instead.</p>\n<p>Also private APIs <code class=\"docutils literal notranslate\">django.template.base.compile_string()</code>,\n<code class=\"docutils literal notranslate\">django.template.loader.find_template()</code>, and\n<code class=\"docutils literal notranslate\">django.template.loader.get_template_from_string()</code> were removed.</p>\n</section>\n<section id=\"model-attribute-on-private-model-relations\">\n<h3><code class=\"docutils literal notranslate\">model</code> attribute on private model relations<a class=\"heading-anchor\" href=\"#model-attribute-on-private-model-relations\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In earlier versions of Django, on a model with a reverse foreign key\nrelationship (for example), <code class=\"docutils literal notranslate\">model._meta.get_all_related_objects()</code> returned\nthe relationship as a <code class=\"docutils literal notranslate\">django.db.models.related.RelatedObject</code> with the\n<code class=\"docutils literal notranslate\">model</code> attribute set to the source of the relationship. Now, this method\nreturns the relationship as <code class=\"docutils literal notranslate\">django.db.models.fields.related.ManyToOneRel</code>\n(private API <code class=\"docutils literal notranslate\">RelatedObject</code> has been removed), and the <code class=\"docutils literal notranslate\">model</code> attribute\nis set to the target of the relationship instead of the source. The source\nmodel is accessible on the <code class=\"docutils literal notranslate\">related_model</code> attribute instead.</p>\n<p>Consider this example from the tutorial in Django 1.8:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>p <span class=\"o\">=</span> Poll<span class=\"o\">.</span>objects<span class=\"o\">.</span>get<span class=\"p\">(</span>pk<span class=\"o\">=</span><span class=\"mi\">1</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>p<span class=\"o\">.</span>_meta<span class=\"o\">.</span>get_all_related_objects<span class=\"p\">()</span>\n<span class=\"go\">[&lt;ManyToOneRel: polls.choice&gt;]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>p<span class=\"o\">.</span>_meta<span class=\"o\">.</span>get_all_related_objects<span class=\"p\">()[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span>model\n<span class=\"go\">&lt;class &#39;polls.models.Poll&#39;&gt;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>p<span class=\"o\">.</span>_meta<span class=\"o\">.</span>get_all_related_objects<span class=\"p\">()[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span>related_model\n<span class=\"go\">&lt;class &#39;polls.models.Choice&#39;&gt;</span>\n</code></pre></div>\n<p>and compare it to the behavior on older versions:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>p<span class=\"o\">.</span>_meta<span class=\"o\">.</span>get_all_related_objects<span class=\"p\">()</span>\n<span class=\"go\">[&lt;RelatedObject: polls:choice related to poll&gt;]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>p<span class=\"o\">.</span>_meta<span class=\"o\">.</span>get_all_related_objects<span class=\"p\">()[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span>model\n<span class=\"go\">&lt;class &#39;polls.models.Choice&#39;&gt;</span>\n</code></pre></div>\n<p>To access the source model, you can use a pattern like this to write code that\nwill work with both Django 1.8 and older versions:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"k\">for</span> relation <span class=\"ow\">in</span> opts<span class=\"o\">.</span>get_all_related_objects<span class=\"p\">():</span>\n    to_model <span class=\"o\">=</span> <span class=\"nb\">getattr</span><span class=\"p\">(</span>relation<span class=\"p\">,</span> <span class=\"s2\">&quot;related_model&quot;</span><span class=\"p\">,</span> relation<span class=\"o\">.</span>model<span class=\"p\">)</span>\n</code></pre></div>\n<p>Also note that <code class=\"docutils literal notranslate\">get_all_related_objects()</code> is deprecated in 1.8.</p>\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>The following changes to the database backend API are documented to assist\nthose writing third-party backends in updating their code:</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">BaseDatabaseXXX</code> classes have been moved to <code class=\"docutils literal notranslate\">django.db.backends.base</code>.\nPlease import them from the new locations:</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.backends.base.base</span> <span class=\"kn\">import</span> BaseDatabaseWrapper\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.base.client</span> <span class=\"kn\">import</span> BaseDatabaseClient\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.base.creation</span> <span class=\"kn\">import</span> BaseDatabaseCreation\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.base.features</span> <span class=\"kn\">import</span> BaseDatabaseFeatures\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.base.introspection</span> <span class=\"kn\">import</span> BaseDatabaseIntrospection\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.base.introspection</span> <span class=\"kn\">import</span> FieldInfo<span class=\"p\">,</span> TableInfo\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.base.operations</span> <span class=\"kn\">import</span> BaseDatabaseOperations\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.base.schema</span> <span class=\"kn\">import</span> BaseDatabaseSchemaEditor\n<span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.base.validation</span> <span class=\"kn\">import</span> BaseDatabaseValidation\n</code></pre></div>\n</li>\n<li><p>The <code class=\"docutils literal notranslate\">data_types</code>, <code class=\"docutils literal notranslate\">data_types_suffix</code>, and\n<code class=\"docutils literal notranslate\">data_type_check_constraints</code> attributes have moved from the\n<code class=\"docutils literal notranslate\">DatabaseCreation</code> class to <code class=\"docutils literal notranslate\">DatabaseWrapper</code>.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">SQLCompiler.as_sql()</code> method now takes a <code class=\"docutils literal notranslate\">subquery</code> parameter\n(<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/24164\">#24164</a>).</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">BaseDatabaseOperations.date_interval_sql()</code> method now only takes a\n<code class=\"docutils literal notranslate\">timedelta</code> parameter.</p></li>\n</ul>\n</section>\n<section id=\"id2\">\n<h3><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=\"#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\">AdminSite</code> no longer takes an <code class=\"docutils literal notranslate\">app_name</code> argument and its <code class=\"docutils literal notranslate\">app_name</code>\nattribute has been removed. The application name is always <code class=\"docutils literal notranslate\">admin</code> (as\nopposed to the instance name which you can still customize using\n<code class=\"docutils literal notranslate\">AdminSite(name=&quot;...&quot;)</code>).</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">ModelAdmin.get_object()</code> method (private API) now takes a third\nargument named <code class=\"docutils literal notranslate\">from_field</code> in order to specify which field should match\nthe provided <code class=\"docutils literal notranslate\">object_id</code>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.response_delete\" title=\"django.contrib.admin.ModelAdmin.response_delete\"><code class=\"xref py py-meth docutils literal notranslate\">ModelAdmin.response_delete()</code></a> method\nnow takes a second argument named <code class=\"docutils literal notranslate\">obj_id</code> which is the serialized\nidentifier used to retrieve the object before deletion.</p></li>\n</ul>\n</section>\n<section id=\"default-autoescaping-of-functions-in-django-template-defaultfilters\">\n<h3>Default autoescaping of functions in <code class=\"docutils literal notranslate\">django.template.defaultfilters</code><a class=\"heading-anchor\" href=\"#default-autoescaping-of-functions-in-django-template-defaultfilters\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In order to make built-in template filters that output HTML “safe by default”\nwhen calling them in Python code, the following functions in\n<code class=\"docutils literal notranslate\">django.template.defaultfilters</code> have been changed to automatically escape\ntheir input value:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">join</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">linebreaksbr</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">linebreaks_filter</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">linenumbers</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">unordered_list</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">urlize</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">urlizetrunc</code></p></li>\n</ul>\n<p>You can revert to the old behavior by specifying <code class=\"docutils literal notranslate\">autoescape=False</code> if you\nare passing trusted content. This change doesn’t have any effect when using\nthe corresponding filters in templates.</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><code class=\"docutils literal notranslate\">connections.queries</code> is now a read-only attribute.</p></li>\n<li><p>Database connections are considered equal only if they’re the same object.\nThey aren’t hashable any more.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.middleware.gzip.GZipMiddleware\" title=\"django.middleware.gzip.GZipMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">GZipMiddleware</code></a> used to disable compression\nfor some content types when the request is from Internet Explorer, in order\nto work around a bug in IE6 and earlier. This behavior could affect\nperformance on IE7 and later. It was removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">URLField.to_python</code> no longer adds a trailing slash to pathless URLs.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-length\"><code class=\"xref std std-tfilter docutils literal notranslate\">length</code></a> template filter now returns <code class=\"docutils literal notranslate\">0</code> for an undefined\nvariable, rather than an empty string.</p></li>\n<li><p><code class=\"docutils literal notranslate\">ForeignKey.default_error_message['invalid']</code> has been changed from\n<code class=\"docutils literal notranslate\">'%(model)s instance with pk %(pk)r does not exist.'</code> to\n<code class=\"docutils literal notranslate\">'%(model)s instance with %(field)s %(value)r does not exist.'</code> If you are\nusing this message in your own code, please update the list of interpolated\nparameters. Internally, Django will continue to provide the\n<code class=\"docutils literal notranslate\">pk</code> parameter in <code class=\"docutils literal notranslate\">params</code> for backwards compatibility.</p></li>\n<li><p><code class=\"docutils literal notranslate\">UserCreationForm.error_messages['duplicate_username']</code> is no longer used.\nIf you wish to customize that error message, <a class=\"reference internal\" href=\"/en/dev/topics/forms/modelforms/#modelforms-overriding-default-fields\"><span class=\"std std-ref\">override it on the form</span></a> using the <code class=\"docutils literal notranslate\">'unique'</code> key in\n<code class=\"docutils literal notranslate\">Meta.error_messages['username']</code> or, if you have a custom form field for\n<code class=\"docutils literal notranslate\">'username'</code>, using the <code class=\"docutils literal notranslate\">'unique'</code> key in its\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.Field.error_messages\" title=\"django.forms.Field.error_messages\"><code class=\"xref py py-attr docutils literal notranslate\">error_messages</code></a> argument.</p></li>\n<li><p>The block <code class=\"docutils literal notranslate\">usertools</code> in the <code class=\"docutils literal notranslate\">base.html</code> template of\n<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> now requires the <code class=\"docutils literal notranslate\">has_permission</code> context\nvariable to be set. If you have any custom admin views that use this\ntemplate, update them to pass <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.AdminSite.has_permission\" title=\"django.contrib.admin.AdminSite.has_permission\"><code class=\"xref py py-meth docutils literal notranslate\">AdminSite.has_permission()</code></a> as this new variable’s\nvalue or simply include <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.AdminSite.each_context\" title=\"django.contrib.admin.AdminSite.each_context\"><code class=\"xref py py-meth docutils literal notranslate\">AdminSite.each_context(request)</code></a> in the context.</p></li>\n<li><p>Internal changes were made to the <a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.ClearableFileInput\" title=\"django.forms.ClearableFileInput\"><code class=\"xref py py-class docutils literal notranslate\">ClearableFileInput</code></a>\nwidget to allow more customization. The undocumented <code class=\"docutils literal notranslate\">url_markup_template</code>\nattribute was removed in favor of <code class=\"docutils literal notranslate\">template_with_initial</code>.</p></li>\n<li><p>For consistency with other major vendors, the <code class=\"docutils literal notranslate\">en_GB</code> locale now has Monday\nas the first day of the week.</p></li>\n<li><p>Seconds have been removed from any locales that had them in <code class=\"docutils literal notranslate\">TIME_FORMAT</code>,\n<code class=\"docutils literal notranslate\">DATETIME_FORMAT</code>, or <code class=\"docutils literal notranslate\">SHORT_DATETIME_FORMAT</code>.</p></li>\n<li><p>The default max size of the Oracle test tablespace has increased from 300M\n(or 200M, before 1.7.2) to 500M.</p></li>\n<li><p><code class=\"docutils literal notranslate\">reverse()</code> and <code class=\"docutils literal notranslate\">reverse_lazy()</code> now return Unicode strings instead of\nbytestrings.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">CacheClass</code> shim has been removed from all cache backends.\nThese aliases were provided for backwards compatibility with Django 1.3.\nIf you are still using them, please update your project to use the real\nclass name found in the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-CACHES-BACKEND\"><code class=\"xref std std-setting docutils literal notranslate\">BACKEND</code></a> key of the\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-CACHES\"><code class=\"xref std std-setting docutils literal notranslate\">CACHES</code></a> setting.</p></li>\n<li><p>By default, <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django.core.management.call_command\" title=\"django.core.management.call_command\"><code class=\"xref py py-func docutils literal notranslate\">call_command()</code></a> now always skips the\ncheck framework (unless you pass it <code class=\"docutils literal notranslate\">skip_checks=False</code>).</p></li>\n<li><p>When iterating over lines, <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 uses\n<span class=\"target\" id=\"index-0\"></span><a class=\"pep reference external\" href=\"https://peps.python.org/pep-0278/\"><strong>universal newlines</strong></a>. The following are recognized as ending a\nline: the Unix end-of-line convention <code class=\"docutils literal notranslate\">'\\n'</code>, the Windows convention\n<code class=\"docutils literal notranslate\">'\\r\\n'</code>, and the old Macintosh convention <code class=\"docutils literal notranslate\">'\\r'</code>.</p></li>\n<li><p>The Memcached cache backends <code class=\"docutils literal notranslate\">MemcachedCache</code> and <code class=\"docutils literal notranslate\">PyLibMCCache</code> will\ndelete a key if <code class=\"docutils literal notranslate\">set()</code> fails. This is necessary to ensure the <code class=\"docutils literal notranslate\">cache_db</code>\nsession store always fetches the most current session data.</p></li>\n<li><p>Private APIs <code class=\"docutils literal notranslate\">override_template_loaders</code> and <code class=\"docutils literal notranslate\">override_with_test_loader</code>\nin <code class=\"docutils literal notranslate\">django.test.utils</code> were removed. Override <code class=\"docutils literal notranslate\">TEMPLATES</code> with\n<code class=\"docutils literal notranslate\">override_settings</code> instead.</p></li>\n<li><p>Warnings from the MySQL database backend are no longer converted to\nexceptions when <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\">DEBUG</code></a> is <code class=\"docutils literal notranslate\">True</code>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest\" title=\"django.http.HttpRequest\"><code class=\"xref py py-class docutils literal notranslate\">HttpRequest</code></a> now has a simplified <code class=\"docutils literal notranslate\">repr</code> (e.g.\n<code class=\"docutils literal notranslate\">&lt;WSGIRequest: GET '/somepath/'&gt;</code>). This won’t change the behavior of\nthe <a class=\"reference internal\" href=\"/en/dev/howto/error-reporting/#django.views.debug.SafeExceptionReporterFilter\" title=\"django.views.debug.SafeExceptionReporterFilter\"><code class=\"xref py py-class docutils literal notranslate\">SafeExceptionReporterFilter</code></a> class.</p></li>\n<li><p>Class-based views that use <a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-editing/#django.views.generic.edit.ModelFormMixin\" title=\"django.views.generic.edit.ModelFormMixin\"><code class=\"xref py py-class docutils literal notranslate\">ModelFormMixin</code></a>\nwill raise an <a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.core.exceptions.ImproperlyConfigured\" title=\"django.core.exceptions.ImproperlyConfigured\"><code class=\"xref py py-exc docutils literal notranslate\">ImproperlyConfigured</code></a> exception\nwhen both the <code class=\"docutils literal notranslate\">fields</code> and <code class=\"docutils literal notranslate\">form_class</code> attributes are specified.\nPreviously, <code class=\"docutils literal notranslate\">fields</code> was silently ignored.</p></li>\n<li><p>When following redirects, the test client now raises\n<a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.test.client.RedirectCycleError\" title=\"django.test.client.RedirectCycleError\"><code class=\"xref py py-exc docutils literal notranslate\">RedirectCycleError</code></a> if it detects a loop or hits a\nmaximum redirect limit (rather than passing silently).</p></li>\n<li><p>Translatable strings set as the <code class=\"docutils literal notranslate\">default</code> parameter of the field are cast\nto concrete strings later, so the return type of <code class=\"docutils literal notranslate\">Field.get_default()</code> is\ndifferent in some cases. There is no change to default values which are the\nresult of a callable.</p></li>\n<li><p><code class=\"docutils literal notranslate\">GenericIPAddressField.empty_strings_allowed</code> is now <code class=\"docutils literal notranslate\">False</code>. Database\nbackends that interpret empty strings as null (only Oracle among the backends\nthat Django includes) will no longer convert null values back to an empty\nstring. This is consistent with other backends.</p></li>\n<li><p>When the <code class=\"docutils literal notranslate\">BaseCommand.leave_locale_alone</code>\nattribute is <code class=\"docutils literal notranslate\">False</code>, translations are now deactivated instead of forcing\nthe “en-us” locale. In the case your models contained non-English strings and\nyou counted on English translations to be activated in management commands,\nthis will not happen any longer. It might be that new database migrations are\ngenerated (once) after migrating to 1.8.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.translation.get_language\" title=\"django.utils.translation.get_language\"><code class=\"xref py py-func docutils literal notranslate\">django.utils.translation.get_language()</code></a> now returns <code class=\"docutils literal notranslate\">None</code> instead\nof <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LANGUAGE_CODE\"><code class=\"xref std std-setting docutils literal notranslate\">LANGUAGE_CODE</code></a> when translations are temporarily deactivated.</p></li>\n<li><p>When a translation doesn’t exist for a specific literal, the fallback is now\ntaken from the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LANGUAGE_CODE\"><code class=\"xref std std-setting docutils literal notranslate\">LANGUAGE_CODE</code></a> language (instead of from the\nuntranslated <code class=\"docutils literal notranslate\">msgid</code> message).</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">name</code> field of <a class=\"reference internal\" href=\"/en/dev/ref/contrib/contenttypes/#django.contrib.contenttypes.models.ContentType\" title=\"django.contrib.contenttypes.models.ContentType\"><code class=\"xref py py-class docutils literal notranslate\">django.contrib.contenttypes.models.ContentType</code></a>\nhas been removed by a migration and replaced by a property. That means it’s\nnot possible to query or filter a <code class=\"docutils literal notranslate\">ContentType</code> by this field any longer.</p>\n<p>Be careful if you upgrade to Django 1.8 and skip Django 1.7. If you run\n<code class=\"docutils literal notranslate\">manage.py migrate --fake</code>, this migration will be skipped and you’ll see\na <code class=\"docutils literal notranslate\">RuntimeError: Error creating new content types.</code> exception because the\n<code class=\"docutils literal notranslate\">name</code> column won’t be dropped from the database. Use <code class=\"docutils literal notranslate\">manage.py migrate\n--fake-initial</code> to fake only the initial migration instead.</p>\n</li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-migrate-fake-initial\"><code class=\"xref std std-option docutils literal notranslate\">migrate --fake-initial</code></a> option allows faking initial\nmigrations. In 1.7, initial migrations were always automatically faked if all\ntables created in an initial migration already existed.</p></li>\n<li><p>An app <em>without</em> migrations with a <code class=\"docutils literal notranslate\">ForeignKey</code> to an app <em>with</em> migrations\nmay now result in a foreign key constraint error when migrating the database\nor running tests. In Django 1.7, this could fail silently and result in a\nmissing constraint. To resolve the error, add migrations to the app without\nthem.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"features-deprecated-in-1-8\">\n<span id=\"deprecated-features-1-8\"></span><h2>Features deprecated in 1.8<a class=\"heading-anchor\" href=\"#features-deprecated-in-1-8\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"selected-methods-in-django-db-models-options-options\">\n<h3>Selected methods in <code class=\"docutils literal notranslate\">django.db.models.options.Options</code><a class=\"heading-anchor\" href=\"#selected-methods-in-django-db-models-options-options\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>As part of the formalization of the <code class=\"docutils literal notranslate\">Model._meta</code> API (from the\n<a class=\"reference internal\" href=\"/en/dev/ref/models/meta/#django.db.models.options.Options\" title=\"django.db.models.options.Options\"><code class=\"xref py py-class docutils literal notranslate\">django.db.models.options.Options</code></a> class), a number of methods have been\ndeprecated and will be removed in Django 1.10:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">get_all_field_names()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_objects()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_objects_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_many_to_many_objects()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_m2m_objects_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_concrete_fields_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_field_by_name()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_fields_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_m2m_with_model()</code></p></li>\n</ul>\n</section>\n<section id=\"loading-cycle-and-firstof-template-tags-from-future-library\">\n<h3>Loading <code class=\"docutils literal notranslate\">cycle</code> and <code class=\"docutils literal notranslate\">firstof</code> template tags from <code class=\"docutils literal notranslate\">future</code> library<a class=\"heading-anchor\" href=\"#loading-cycle-and-firstof-template-tags-from-future-library\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.6 introduced <code class=\"docutils literal notranslate\">{% load cycle from future %}</code> and\n<code class=\"docutils literal notranslate\">{% load firstof from future %}</code> syntax for forward compatibility of the\n<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> and <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-firstof\"><code class=\"xref std std-ttag docutils literal notranslate\">firstof</code></a> template tags. This syntax is now deprecated\nand will be removed in Django 1.10. You can simply remove the\n<code class=\"docutils literal notranslate\">{% load ... from future %}</code> tags.</p>\n</section>\n<section id=\"django-conf-urls-patterns\">\n<h3><code class=\"docutils literal notranslate\">django.conf.urls.patterns()</code><a class=\"heading-anchor\" href=\"#django-conf-urls-patterns\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In the olden days of Django, it was encouraged to reference views as strings\nin <code class=\"docutils literal notranslate\">urlpatterns</code>:</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>urlpatterns <span class=\"o\">=</span> patterns<span class=\"p\">(</span>\n    <span class=\"s2\">&quot;&quot;</span><span class=\"p\">,</span>\n    url<span class=\"p\">(</span><span class=\"s2\">&quot;^$&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;myapp.views.myview&quot;</span><span class=\"p\">),</span>\n<span class=\"p\">)</span>\n</code></pre></div>\n<p>and Django would magically import <code class=\"docutils literal notranslate\">myapp.views.myview</code> internally and turn\nthe string into a real function reference. In order to reduce repetition when\nreferencing many views from the same module, the <code class=\"docutils literal notranslate\">patterns()</code> function takes\na required initial <code class=\"docutils literal notranslate\">prefix</code> argument which is prepended to all\nviews-as-strings in that set of <code class=\"docutils literal notranslate\">urlpatterns</code>:</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>urlpatterns <span class=\"o\">=</span> patterns<span class=\"p\">(</span>\n    <span class=\"s2\">&quot;myapp.views&quot;</span><span class=\"p\">,</span>\n    url<span class=\"p\">(</span><span class=\"s2\">&quot;^$&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;myview&quot;</span><span class=\"p\">),</span>\n    url<span class=\"p\">(</span><span class=\"s2\">&quot;^other/$&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;otherview&quot;</span><span class=\"p\">),</span>\n<span class=\"p\">)</span>\n</code></pre></div>\n<p>In the modern era, we have updated the tutorial to instead recommend importing\nyour views module and referencing your view functions (or classes) directly.\nThis has a number of advantages, all deriving from the fact that we are using\nnormal Python in place of “Django String Magic”: the errors when you mistype a\nview name are less obscure, IDEs can help with autocompletion of view names,\netc.</p>\n<p>So these days, the above use of the <code class=\"docutils literal notranslate\">prefix</code> arg is much more likely to be\nwritten (and is better written) as:</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\">myapp</span> <span class=\"kn\">import</span> views\n\nurlpatterns <span class=\"o\">=</span> patterns<span class=\"p\">(</span>\n    <span class=\"s2\">&quot;&quot;</span><span class=\"p\">,</span>\n    url<span class=\"p\">(</span><span class=\"s2\">&quot;^$&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>myview<span class=\"p\">),</span>\n    url<span class=\"p\">(</span><span class=\"s2\">&quot;^other/$&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>otherview<span class=\"p\">),</span>\n<span class=\"p\">)</span>\n</code></pre></div>\n<p>Thus <code class=\"docutils literal notranslate\">patterns()</code> serves little purpose and is a burden when teaching new\nusers (answering the newbie’s question “why do I need this empty string as the\nfirst argument to <code class=\"docutils literal notranslate\">patterns()</code>?”). For these reasons, we are deprecating it.\nUpdating your code is as simple as ensuring that <code class=\"docutils literal notranslate\">urlpatterns</code> is a list of\n<code class=\"docutils literal notranslate\">django.conf.urls.url()</code> instances. 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.conf.urls</span> <span class=\"kn\">import</span> url\n<span class=\"kn\">from</span> <span class=\"nn\">myapp</span> <span class=\"kn\">import</span> views\n\nurlpatterns <span class=\"o\">=</span> <span class=\"p\">[</span>\n    url<span class=\"p\">(</span><span class=\"s2\">&quot;^$&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>myview<span class=\"p\">),</span>\n    url<span class=\"p\">(</span><span class=\"s2\">&quot;^other/$&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>otherview<span class=\"p\">),</span>\n<span class=\"p\">]</span>\n</code></pre></div>\n</section>\n<section id=\"passing-a-string-as-view-to-django-conf-urls-url\">\n<h3>Passing a string as <code class=\"docutils literal notranslate\">view</code> to <code class=\"docutils literal notranslate\">django.conf.urls.url()</code><a class=\"heading-anchor\" href=\"#passing-a-string-as-view-to-django-conf-urls-url\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Related to the previous item, referencing views as strings in the <code class=\"docutils literal notranslate\">url()</code>\nfunction is deprecated. Pass the callable view as described in the previous\nsection instead.</p>\n</section>\n<section id=\"template-related-settings\">\n<h3>Template-related settings<a class=\"heading-anchor\" href=\"#template-related-settings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>As a consequence of the multiple template engines refactor, several settings\nare deprecated in favor of <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-TEMPLATES\"><code class=\"xref std std-setting docutils literal notranslate\">TEMPLATES</code></a>:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">ALLOWED_INCLUDE_ROOTS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_CONTEXT_PROCESSORS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_DEBUG</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_DIRS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_LOADERS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_STRING_IF_INVALID</code></p></li>\n</ul>\n</section>\n<section id=\"django-core-context-processors\">\n<h3><code class=\"docutils literal notranslate\">django.core.context_processors</code><a class=\"heading-anchor\" href=\"#django-core-context-processors\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Built-in template context processors have been moved to\n<code class=\"docutils literal notranslate\">django.template.context_processors</code>.</p>\n</section>\n<section id=\"django-test-simpletestcase-urls\">\n<h3><code class=\"docutils literal notranslate\">django.test.SimpleTestCase.urls</code><a class=\"heading-anchor\" href=\"#django-test-simpletestcase-urls\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The attribute <code class=\"docutils literal notranslate\">SimpleTestCase.urls</code> for specifying URLconf configuration in\ntests has been deprecated and will be removed in Django 1.10. Use\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.override_settings\" title=\"django.test.override_settings\"><code class=\"xref py py-func docutils literal notranslate\">&#64;override_settings(ROOT_URLCONF=...)</code></a>\ninstead.</p>\n</section>\n<section id=\"prefix-argument-to-i18n-patterns\">\n<h3><code class=\"docutils literal notranslate\">prefix</code> argument to <a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.conf.urls.i18n.i18n_patterns\" title=\"django.conf.urls.i18n.i18n_patterns\"><code class=\"xref py py-func docutils literal notranslate\">i18n_patterns()</code></a><a class=\"heading-anchor\" href=\"#prefix-argument-to-i18n-patterns\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Related to the previous item, the <code class=\"docutils literal notranslate\">prefix</code> argument to\n<a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#django.conf.urls.i18n.i18n_patterns\" title=\"django.conf.urls.i18n.i18n_patterns\"><code class=\"xref py py-func docutils literal notranslate\">django.conf.urls.i18n.i18n_patterns()</code></a> has been deprecated. Simply pass a\nlist of <code class=\"docutils literal notranslate\">django.conf.urls.url()</code> instances instead.</p>\n</section>\n<section id=\"using-an-incorrect-count-of-unpacked-values-in-the-for-template-tag\">\n<h3>Using an incorrect count of unpacked values in the <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-for\"><code class=\"xref std std-ttag docutils literal notranslate\">for</code></a> template tag<a class=\"heading-anchor\" href=\"#using-an-incorrect-count-of-unpacked-values-in-the-for-template-tag\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Using an incorrect count of unpacked values in <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-for\"><code class=\"xref std std-ttag docutils literal notranslate\">for</code></a> tag will raise an\nexception rather than fail silently in Django 1.10.</p>\n</section>\n<section id=\"passing-a-dotted-path-to-reverse-and-url\">\n<h3>Passing a dotted path to <code class=\"docutils literal notranslate\">reverse()</code> and <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-url\"><code class=\"xref std std-ttag docutils literal notranslate\">url</code></a><a class=\"heading-anchor\" href=\"#passing-a-dotted-path-to-reverse-and-url\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Reversing URLs by Python path is an expensive operation as it causes the\npath being reversed to be imported. This behavior has also resulted in a\n<a class=\"reference external\" href=\"https://www.djangoproject.com/weblog/2014/apr/21/security/#s-issue-unexpected-code-execution-using-reverse\">security issue</a>. Use <a class=\"reference internal\" href=\"/en/dev/topics/http/urls/#naming-url-patterns\"><span class=\"std std-ref\">named URL patterns</span></a>\nfor reversing instead.</p>\n<p>If you are using <a class=\"reference internal\" href=\"/en/dev/ref/contrib/sitemaps/#module-django.contrib.sitemaps\" title=\"django.contrib.sitemaps: A framework for generating Google sitemap XML files.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.sitemaps</code></a>, add the <code class=\"docutils literal notranslate\">name</code> argument to\nthe <code class=\"docutils literal notranslate\">url</code> that references <a class=\"reference internal\" href=\"/en/dev/ref/contrib/sitemaps/#django.contrib.sitemaps.views.sitemap\" title=\"django.contrib.sitemaps.views.sitemap\"><code class=\"xref py py-func docutils literal notranslate\">django.contrib.sitemaps.views.sitemap()</code></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\">django.contrib.sitemaps.views</span> <span class=\"kn\">import</span> sitemap\n\nurl<span class=\"p\">(</span>\n    <span class=\"sa\">r</span><span class=\"s2\">&quot;^sitemap\\.xml$&quot;</span><span class=\"p\">,</span>\n    sitemap<span class=\"p\">,</span>\n    <span class=\"p\">{</span><span class=\"s2\">&quot;sitemaps&quot;</span><span class=\"p\">:</span> sitemaps<span class=\"p\">},</span>\n    name<span class=\"o\">=</span><span class=\"s2\">&quot;django.contrib.sitemaps.views.sitemap&quot;</span><span class=\"p\">,</span>\n<span class=\"p\">)</span>\n</code></pre></div>\n<p>to ensure compatibility when reversing by Python path is removed in Django\n1.10.</p>\n<p>Similarly for GIS sitemaps, add\n<code class=\"docutils literal notranslate\">name='django.contrib.gis.sitemaps.views.kml'</code> or\n<code class=\"docutils literal notranslate\">name='django.contrib.gis.sitemaps.views.kmz'</code>.</p>\n<p>If you are using a Python path for the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOGIN_URL\"><code class=\"xref std std-setting docutils literal notranslate\">LOGIN_URL</code></a> or\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOGIN_REDIRECT_URL\"><code class=\"xref std std-setting docutils literal notranslate\">LOGIN_REDIRECT_URL</code></a> setting, use the name of the <code class=\"docutils literal notranslate\">url()</code> instead.</p>\n</section>\n<section id=\"aggregate-methods-and-modules\">\n<h3>Aggregate methods and modules<a class=\"heading-anchor\" href=\"#aggregate-methods-and-modules\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">django.db.models.sql.aggregates</code> and\n<code class=\"docutils literal notranslate\">django.contrib.gis.db.models.sql.aggregates</code> modules (both private API),\nhave been deprecated as <code class=\"docutils literal notranslate\">django.db.models.aggregates</code> and\n<code class=\"docutils literal notranslate\">django.contrib.gis.db.models.aggregates</code> are now also responsible for SQL\ngeneration. The old modules will be removed in Django 1.10.</p>\n<p>If you were using the old modules, see <a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/\"><span class=\"doc\">Query Expressions</span></a> for instructions on rewriting custom aggregates\nusing the new stable API.</p>\n<p>The following methods and properties of <code class=\"docutils literal notranslate\">django.db.models.sql.query.Query</code>\nhave also been deprecated and the backwards compatibility shims will be removed\nin Django 1.10:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">Query.aggregates</code>, replaced by <code class=\"docutils literal notranslate\">annotations</code>.</p></li>\n<li><p><code class=\"docutils literal notranslate\">Query.aggregate_select</code>, replaced by <code class=\"docutils literal notranslate\">annotation_select</code>.</p></li>\n<li><p><code class=\"docutils literal notranslate\">Query.add_aggregate()</code>, replaced by <code class=\"docutils literal notranslate\">add_annotation()</code>.</p></li>\n<li><p><code class=\"docutils literal notranslate\">Query.set_aggregate_mask()</code>, replaced by <code class=\"docutils literal notranslate\">set_annotation_mask()</code>.</p></li>\n<li><p><code class=\"docutils literal notranslate\">Query.append_aggregate_mask()</code>, replaced by <code class=\"docutils literal notranslate\">append_annotation_mask()</code>.</p></li>\n</ul>\n</section>\n<section id=\"extending-management-command-arguments-through-command-option-list\">\n<h3>Extending management command arguments through <code class=\"docutils literal notranslate\">Command.option_list</code><a class=\"heading-anchor\" href=\"#extending-management-command-arguments-through-command-option-list\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Management commands now use <a class=\"reference external\" href=\"https://docs.python.org/3/library/argparse.html#module-argparse\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">argparse</code></a> instead of <a class=\"reference external\" href=\"https://docs.python.org/3/library/optparse.html#module-optparse\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">optparse</code></a> to\nparse command-line arguments passed to commands. This also means that the way\nto add custom arguments to commands has changed: instead of extending the\n<code class=\"docutils literal notranslate\">option_list</code> class list, you should now override the\n<a class=\"reference internal\" href=\"/en/dev/howto/custom-management-commands/#django.core.management.BaseCommand.add_arguments\" title=\"django.core.management.BaseCommand.add_arguments\"><code class=\"xref py py-meth docutils literal notranslate\">add_arguments()</code></a> method and add\narguments through <code class=\"docutils literal notranslate\">argparse.add_argument()</code>. See\n<a class=\"reference internal\" href=\"/en/dev/howto/custom-management-commands/#custom-commands-options\"><span class=\"std std-ref\">this example</span></a> for more details.</p>\n</section>\n<section id=\"django-core-management-noargscommand\">\n<h3><code class=\"docutils literal notranslate\">django.core.management.NoArgsCommand</code><a class=\"heading-anchor\" href=\"#django-core-management-noargscommand\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The class <code class=\"docutils literal notranslate\">NoArgsCommand</code> is now deprecated and will be removed in Django\n1.10. Use <a class=\"reference internal\" href=\"/en/dev/howto/custom-management-commands/#django.core.management.BaseCommand\" title=\"django.core.management.BaseCommand\"><code class=\"xref py py-class docutils literal notranslate\">BaseCommand</code></a> instead, which takes no\narguments by default.</p>\n</section>\n<section id=\"listing-all-migrations-in-a-project\">\n<h3>Listing all migrations in a project<a class=\"heading-anchor\" href=\"#listing-all-migrations-in-a-project\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">--list</code> option of the <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-migrate\"><code class=\"xref std std-djadmin docutils literal notranslate\">migrate</code></a> management command is\ndeprecated and will be removed in Django 1.10. Use <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-showmigrations\"><code class=\"xref std std-djadmin docutils literal notranslate\">showmigrations</code></a>\ninstead.</p>\n</section>\n<section id=\"cache-choices-option-of-modelchoicefield-and-modelmultiplechoicefield\">\n<h3><code class=\"docutils literal notranslate\">cache_choices</code> option of <code class=\"docutils literal notranslate\">ModelChoiceField</code> and <code class=\"docutils literal notranslate\">ModelMultipleChoiceField</code><a class=\"heading-anchor\" href=\"#cache-choices-option-of-modelchoicefield-and-modelmultiplechoicefield\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.ModelChoiceField\" title=\"django.forms.ModelChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">ModelChoiceField</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.ModelMultipleChoiceField\" title=\"django.forms.ModelMultipleChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">ModelMultipleChoiceField</code></a> took an undocumented, untested\noption <code class=\"docutils literal notranslate\">cache_choices</code>. This cached querysets between multiple renderings of\nthe same <code class=\"docutils literal notranslate\">Form</code> object. This option is subject to an accelerated deprecation\nand will be removed in Django 1.9.</p>\n</section>\n<section id=\"django-template-resolve-variable\">\n<h3><code class=\"docutils literal notranslate\">django.template.resolve_variable()</code><a class=\"heading-anchor\" href=\"#django-template-resolve-variable\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The function has been informally marked as “Deprecated” for some time. Replace\n<code class=\"docutils literal notranslate\">resolve_variable(path, context)</code> with\n<code class=\"docutils literal notranslate\">django.template.Variable(path).resolve(context)</code>.</p>\n</section>\n<section id=\"django-contrib-webdesign\">\n<h3><code class=\"docutils literal notranslate\">django.contrib.webdesign</code><a class=\"heading-anchor\" href=\"#django-contrib-webdesign\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>It provided the <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-lorem\"><code class=\"xref std std-ttag docutils literal notranslate\">lorem</code></a> template tag which is now included in the\nbuilt-in tags. Simply remove <code class=\"docutils literal notranslate\">'django.contrib.webdesign'</code> from\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-INSTALLED_APPS\"><code class=\"xref std std-setting docutils literal notranslate\">INSTALLED_APPS</code></a> and <code class=\"docutils literal notranslate\">{% load webdesign %}</code> from your templates.</p>\n</section>\n<section id=\"error-message-argument-to-django-forms-regexfield\">\n<h3><code class=\"docutils literal notranslate\">error_message</code> argument to <code class=\"docutils literal notranslate\">django.forms.RegexField</code><a class=\"heading-anchor\" href=\"#error-message-argument-to-django-forms-regexfield\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>It provided backwards compatibility for pre-1.0 code, but its functionality is\nredundant. Use <code class=\"docutils literal notranslate\">Field.error_messages['invalid']</code> instead.</p>\n</section>\n<section id=\"old-unordered-list-syntax\">\n<h3>Old <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-unordered_list\"><code class=\"xref std std-tfilter docutils literal notranslate\">unordered_list</code></a> syntax<a class=\"heading-anchor\" href=\"#old-unordered-list-syntax\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>An older (pre-1.0), more restrictive and verbose input format for the\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-unordered_list\"><code class=\"xref std std-tfilter docutils literal notranslate\">unordered_list</code></a> template filter has been deprecated:</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=\"p\">[</span><span class=\"s2\">&quot;States&quot;</span><span class=\"p\">,</span> <span class=\"p\">[[</span><span class=\"s2\">&quot;Kansas&quot;</span><span class=\"p\">,</span> <span class=\"p\">[[</span><span class=\"s2\">&quot;Lawrence&quot;</span><span class=\"p\">,</span> <span class=\"p\">[]],</span> <span class=\"p\">[</span><span class=\"s2\">&quot;Topeka&quot;</span><span class=\"p\">,</span> <span class=\"p\">[]]]],</span> <span class=\"p\">[</span><span class=\"s2\">&quot;Illinois&quot;</span><span class=\"p\">,</span> <span class=\"p\">[]]]]</span>\n</code></pre></div>\n<p>Using the new syntax, this 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=\"p\">[</span><span class=\"s2\">&quot;States&quot;</span><span class=\"p\">,</span> <span class=\"p\">[</span><span class=\"s2\">&quot;Kansas&quot;</span><span class=\"p\">,</span> <span class=\"p\">[</span><span class=\"s2\">&quot;Lawrence&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;Topeka&quot;</span><span class=\"p\">],</span> <span class=\"s2\">&quot;Illinois&quot;</span><span class=\"p\">]]</span>\n</code></pre></div>\n</section>\n<section id=\"django-forms-field-has-changed\">\n<h3><code class=\"docutils literal notranslate\">django.forms.Field._has_changed()</code><a class=\"heading-anchor\" href=\"#django-forms-field-has-changed\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Rename this method to <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.Field.has_changed\" title=\"django.forms.Field.has_changed\"><code class=\"xref py py-meth docutils literal notranslate\">has_changed()</code></a> by removing the\nleading underscore. The old name will still work until Django 1.10.</p>\n</section>\n<section id=\"django-utils-html-remove-tags-and-removetags-template-filter\">\n<h3><code class=\"docutils literal notranslate\">django.utils.html.remove_tags()</code> and <code class=\"docutils literal notranslate\">removetags</code> template filter<a class=\"heading-anchor\" href=\"#django-utils-html-remove-tags-and-removetags-template-filter\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">django.utils.html.remove_tags()</code> as well as the template filter\n<code class=\"docutils literal notranslate\">removetags</code> have been deprecated as they cannot guarantee safe output. Their\nexistence is likely to lead to their use in security-sensitive contexts where\nthey are not actually safe.</p>\n<p>The unused and undocumented <code class=\"docutils literal notranslate\">django.utils.html.strip_entities()</code> function has\nalso been deprecated.</p>\n</section>\n<section id=\"is-admin-site-argument-to-django-contrib-auth-views-password-reset\">\n<h3><code class=\"docutils literal notranslate\">is_admin_site</code> argument to <code class=\"docutils literal notranslate\">django.contrib.auth.views.password_reset()</code><a class=\"heading-anchor\" href=\"#is-admin-site-argument-to-django-contrib-auth-views-password-reset\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>It’s a legacy option that should no longer be necessary.</p>\n</section>\n<section id=\"subfieldbase\">\n<h3><code class=\"docutils literal notranslate\">SubfieldBase</code><a class=\"heading-anchor\" href=\"#subfieldbase\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">django.db.models.fields.subclassing.SubfieldBase</code> has been deprecated and\nwill be removed in Django 1.10. Historically, it was used to handle fields\nwhere type conversion was needed when loading from the database, but it was not\nused in <code class=\"docutils literal notranslate\">.values()</code> calls or in aggregates. It has been replaced with\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.Field.from_db_value\" title=\"django.db.models.Field.from_db_value\"><code class=\"xref py py-meth docutils literal notranslate\">from_db_value()</code></a>.</p>\n<p>The new approach doesn’t call the <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.Field.to_python\" title=\"django.db.models.Field.to_python\"><code class=\"xref py py-meth docutils literal notranslate\">to_python()</code></a>\nmethod on assignment as was the case with <code class=\"docutils literal notranslate\">SubfieldBase</code>. If you need that\nbehavior, reimplement the <code class=\"docutils literal notranslate\">Creator</code> class <a class=\"reference external\" href=\"https://github.com/django/django/blob/stable/1.8.x/django/db/models/fields/subclassing.py#L31-L44\">from Django’s source code</a>\nin your project.</p>\n</section>\n<section id=\"django-utils-checksums\">\n<h3><code class=\"docutils literal notranslate\">django.utils.checksums</code><a class=\"heading-anchor\" href=\"#django-utils-checksums\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">django.utils.checksums</code> module has been deprecated and will be removed\nin Django 1.10. The functionality it provided (validating checksum using the\nLuhn algorithm) was undocumented and not used in Django. The module has been\nmoved to the <a class=\"extlink-pypi reference external\" href=\"https://pypi.org/project/django-localflavor/\">django-localflavor</a> package (version 1.1+).</p>\n</section>\n<section id=\"inlineadminform-original-content-type-id\">\n<h3><code class=\"docutils literal notranslate\">InlineAdminForm.original_content_type_id</code><a class=\"heading-anchor\" href=\"#inlineadminform-original-content-type-id\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">original_content_type_id</code> attribute on <code class=\"docutils literal notranslate\">InlineAdminForm</code> has been\ndeprecated and will be removed in Django 1.10. Historically, it was used\nto construct the “view on site” URL. This URL is now accessible using the\n<code class=\"docutils literal notranslate\">absolute_url</code> attribute of the form.</p>\n</section>\n<section id=\"django-views-generic-edit-formmixin-get-form-s-form-class-argument\">\n<h3><code class=\"docutils literal notranslate\">django.views.generic.edit.FormMixin.get_form()</code>’s <code class=\"docutils literal notranslate\">form_class</code> argument<a class=\"heading-anchor\" href=\"#django-views-generic-edit-formmixin-get-form-s-form-class-argument\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">FormMixin</code> subclasses that override the <code class=\"docutils literal notranslate\">get_form()</code> method should make\nsure to provide a default value for the <code class=\"docutils literal notranslate\">form_class</code> argument since it’s\nnow optional.</p>\n</section>\n<section id=\"rendering-templates-loaded-by-get-template-with-a-context\">\n<h3>Rendering templates loaded by <a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.loader.get_template\" title=\"django.template.loader.get_template\"><code class=\"xref py py-func docutils literal notranslate\">get_template()</code></a> with a <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">Context</code></a><a class=\"heading-anchor\" href=\"#rendering-templates-loaded-by-get-template-with-a-context\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The return type of <a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.loader.get_template\" title=\"django.template.loader.get_template\"><code class=\"xref py py-func docutils literal notranslate\">get_template()</code></a> has changed\nin Django 1.8: instead of a <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Template\" title=\"django.template.Template\"><code class=\"xref py py-class docutils literal notranslate\">django.template.Template</code></a>, it returns a\n<code class=\"docutils literal notranslate\">Template</code> instance whose exact type depends on which backend loaded it.</p>\n<p>Both classes provide a <code class=\"docutils literal notranslate\">render()</code> method, however, the former takes a\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">django.template.Context</code></a> as an argument while the latter expects a\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/stdtypes.html#dict\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">dict</code></a>. This change is enforced through a deprecation path for Django\ntemplates.</p>\n<p>All this also applies to <a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.loader.select_template\" title=\"django.template.loader.select_template\"><code class=\"xref py py-func docutils literal notranslate\">select_template()</code></a>.</p>\n</section>\n<section id=\"template-and-context-classes-in-template-responses\">\n<h3><a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Template\" title=\"django.template.Template\"><code class=\"xref py py-class docutils literal notranslate\">Template</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">Context</code></a> classes in template responses<a class=\"heading-anchor\" href=\"#template-and-context-classes-in-template-responses\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Some methods of <a class=\"reference internal\" href=\"/en/dev/ref/template-response/#django.template.response.SimpleTemplateResponse\" title=\"django.template.response.SimpleTemplateResponse\"><code class=\"xref py py-class docutils literal notranslate\">SimpleTemplateResponse</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/template-response/#django.template.response.TemplateResponse\" title=\"django.template.response.TemplateResponse\"><code class=\"xref py py-class docutils literal notranslate\">TemplateResponse</code></a> accepted\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">django.template.Context</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Template\" title=\"django.template.Template\"><code class=\"xref py py-class docutils literal notranslate\">django.template.Template</code></a> objects\nas arguments. They should now receive <a class=\"reference external\" href=\"https://docs.python.org/3/library/stdtypes.html#dict\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">dict</code></a> and backend-dependent\ntemplate objects respectively.</p>\n<p>This also applies to the return types if you have subclassed either template\nresponse class.</p>\n<p>Check the <a class=\"reference internal\" href=\"/en/dev/ref/template-response/\"><span class=\"doc\">template response API documentation</span></a>\nfor details.</p>\n</section>\n<section id=\"current-app-argument-of-template-related-apis\">\n<h3><code class=\"docutils literal notranslate\">current_app</code> argument of template-related APIs<a class=\"heading-anchor\" href=\"#current-app-argument-of-template-related-apis\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The following functions and classes will no longer accept a <code class=\"docutils literal notranslate\">current_app</code>\nparameter to set an URL namespace in Django 1.10:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.Context()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.RequestContext()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.response.TemplateResponse()</code></p></li>\n</ul>\n<p>Set <code class=\"docutils literal notranslate\">request.current_app</code> instead, where <code class=\"docutils literal notranslate\">request</code> is the first argument\nto these functions or classes. If you’re using a plain <code class=\"docutils literal notranslate\">Context</code>, use a\n<code class=\"docutils literal notranslate\">RequestContext</code> instead.</p>\n</section>\n<section id=\"dictionary-and-context-instance-arguments-of-rendering-functions\">\n<h3><code class=\"docutils literal notranslate\">dictionary</code> and <code class=\"docutils literal notranslate\">context_instance</code> arguments of rendering functions<a class=\"heading-anchor\" href=\"#dictionary-and-context-instance-arguments-of-rendering-functions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The following functions will no longer accept the <code class=\"docutils literal notranslate\">dictionary</code> and\n<code class=\"docutils literal notranslate\">context_instance</code> parameters in Django 1.10:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render_to_response()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader.render_to_string()</code></p></li>\n</ul>\n<p>Use the <code class=\"docutils literal notranslate\">context</code> parameter instead. When <code class=\"docutils literal notranslate\">dictionary</code> is passed as a\npositional argument, which is the most common idiom, no changes are needed.</p>\n<p>If you’re passing a <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">Context</code></a> in <code class=\"docutils literal notranslate\">context_instance</code>,\npass a <a class=\"reference external\" href=\"https://docs.python.org/3/library/stdtypes.html#dict\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">dict</code></a> in the <code class=\"docutils literal notranslate\">context</code> parameter instead. If you’re passing a\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.RequestContext\" title=\"django.template.RequestContext\"><code class=\"xref py py-class docutils literal notranslate\">RequestContext</code></a>, pass the request separately in the\n<code class=\"docutils literal notranslate\">request</code> parameter.</p>\n</section>\n<section id=\"dirs-argument-of-template-finding-functions\">\n<h3><code class=\"docutils literal notranslate\">dirs</code> argument of template-finding functions<a class=\"heading-anchor\" href=\"#dirs-argument-of-template-finding-functions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The following functions will no longer accept a <code class=\"docutils literal notranslate\">dirs</code> parameter to override\n<code class=\"docutils literal notranslate\">TEMPLATE_DIRS</code> in Django 1.10:</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.loader.get_template\" title=\"django.template.loader.get_template\"><code class=\"xref py py-func docutils literal notranslate\">django.template.loader.get_template()</code></a></p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/templates/#django.template.loader.select_template\" title=\"django.template.loader.select_template\"><code class=\"xref py py-func docutils literal notranslate\">django.template.loader.select_template()</code></a></p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/http/shortcuts/#django.shortcuts.render\" title=\"django.shortcuts.render\"><code class=\"xref py py-func docutils literal notranslate\">django.shortcuts.render()</code></a></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render_to_response()</code></p></li>\n</ul>\n<p>The parameter didn’t work consistently across different template loaders and\ndidn’t work for included templates.</p>\n</section>\n<section id=\"django-template-loader-baseloader\">\n<h3><code class=\"docutils literal notranslate\">django.template.loader.BaseLoader</code><a class=\"heading-anchor\" href=\"#django-template-loader-baseloader\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">django.template.loader.BaseLoader</code> was renamed to\n<code class=\"docutils literal notranslate\">django.template.loaders.base.Loader</code>. If you’ve written a custom template\nloader that inherits <code class=\"docutils literal notranslate\">BaseLoader</code>, you must inherit <code class=\"docutils literal notranslate\">Loader</code> instead.</p>\n</section>\n<section id=\"django-test-utils-testtemplateloader\">\n<h3><code class=\"docutils literal notranslate\">django.test.utils.TestTemplateLoader</code><a class=\"heading-anchor\" href=\"#django-test-utils-testtemplateloader\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Private API <code class=\"docutils literal notranslate\">django.test.utils.TestTemplateLoader</code> is deprecated in favor of\n<code class=\"docutils literal notranslate\">django.template.loaders.locmem.Loader</code> and will be removed in Django 1.9.</p>\n</section>\n<section id=\"support-for-the-max-length-argument-on-custom-storage-classes\">\n<span id=\"storage-max-length-update\"></span><h3>Support for the <code class=\"docutils literal notranslate\">max_length</code> argument on custom <code class=\"docutils literal notranslate\">Storage</code> classes<a class=\"heading-anchor\" href=\"#support-for-the-max-length-argument-on-custom-storage-classes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">Storage</code> subclasses should add <code class=\"docutils literal notranslate\">max_length=None</code> as a parameter to\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.get_available_name\" title=\"django.core.files.storage.Storage.get_available_name\"><code class=\"xref py py-meth docutils literal notranslate\">get_available_name()</code></a> and/or\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.save\" title=\"django.core.files.storage.Storage.save\"><code class=\"xref py py-meth docutils literal notranslate\">save()</code></a> if they override either method.\nSupport for storages that do not accept this argument will be removed in\nDjango 1.10.</p>\n</section>\n<section id=\"qn-replaced-by-compiler\">\n<h3><code class=\"docutils literal notranslate\">qn</code> replaced by <code class=\"docutils literal notranslate\">compiler</code><a class=\"heading-anchor\" href=\"#qn-replaced-by-compiler\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In previous Django versions, various internal ORM methods (mostly <code class=\"docutils literal notranslate\">as_sql</code>\nmethods) accepted a <code class=\"docutils literal notranslate\">qn</code> (for “quote name”) argument, which was a reference\nto a function that quoted identifiers for sending to the database. In Django\n1.8, that argument has been renamed to <code class=\"docutils literal notranslate\">compiler</code> and is now a full\n<code class=\"docutils literal notranslate\">SQLCompiler</code> instance. For backwards-compatibility, calling a\n<code class=\"docutils literal notranslate\">SQLCompiler</code> instance performs the same name-quoting that the <code class=\"docutils literal notranslate\">qn</code>\nfunction used to. However, this backwards-compatibility shim is immediately\ndeprecated: you should rename your <code class=\"docutils literal notranslate\">qn</code> arguments to <code class=\"docutils literal notranslate\">compiler</code>, and call\n<code class=\"docutils literal notranslate\">compiler.quote_name_unless_alias(...)</code> where you previously called\n<code class=\"docutils literal notranslate\">qn(...)</code>.</p>\n</section>\n<section id=\"default-value-of-redirectview-permanent\">\n<h3>Default value of <code class=\"docutils literal notranslate\">RedirectView.permanent</code><a class=\"heading-anchor\" href=\"#default-value-of-redirectview-permanent\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The default value of the <a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/base/#django.views.generic.base.RedirectView.permanent\" title=\"django.views.generic.base.RedirectView.permanent\"><code class=\"xref py py-attr docutils literal notranslate\">RedirectView.permanent</code></a> attribute will change from\n<code class=\"docutils literal notranslate\">True</code> to <code class=\"docutils literal notranslate\">False</code> in Django 1.9.</p>\n</section>\n<section id=\"using-authenticationmiddleware-without-sessionauthenticationmiddleware\">\n<h3>Using <code class=\"docutils literal notranslate\">AuthenticationMiddleware</code> without <code class=\"docutils literal notranslate\">SessionAuthenticationMiddleware</code><a class=\"heading-anchor\" href=\"#using-authenticationmiddleware-without-sessionauthenticationmiddleware\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">django.contrib.auth.middleware.SessionAuthenticationMiddleware</code> was added in\nDjango 1.7. In Django 1.7.2, its functionality was moved to <code class=\"docutils literal notranslate\">auth.get_user()</code>\nand, for backwards compatibility, enabled only if\n<code class=\"docutils literal notranslate\">'django.contrib.auth.middleware.SessionAuthenticationMiddleware'</code> appears in\n<code class=\"docutils literal notranslate\">MIDDLEWARE_CLASSES</code>.</p>\n<p>In Django 1.10, session verification will be enabled regardless of whether or\nnot <code class=\"docutils literal notranslate\">SessionAuthenticationMiddleware</code> is enabled (at which point\n<code class=\"docutils literal notranslate\">SessionAuthenticationMiddleware</code> will have no significance). You can add it\nto your <code class=\"docutils literal notranslate\">MIDDLEWARE_CLASSES</code> sometime before then to opt-in. Please read the\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#session-invalidation-on-password-change\"><span class=\"std std-ref\">upgrade considerations</span></a> first.</p>\n</section>\n<section id=\"django-contrib-sitemaps-flatpagesitemap\">\n<h3><code class=\"docutils literal notranslate\">django.contrib.sitemaps.FlatPageSitemap</code><a class=\"heading-anchor\" href=\"#django-contrib-sitemaps-flatpagesitemap\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">django.contrib.sitemaps.FlatPageSitemap</code> has moved to\n<code class=\"docutils literal notranslate\">django.contrib.flatpages.sitemaps.FlatPageSitemap</code>. The old import location\nis deprecated and will be removed in Django 1.9.</p>\n</section>\n<section id=\"model-field-related\">\n<h3>Model <code class=\"docutils literal notranslate\">Field.related</code><a class=\"heading-anchor\" href=\"#model-field-related\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Private attribute <code class=\"docutils literal notranslate\">django.db.models.Field.related</code> is deprecated in favor\nof <code class=\"docutils literal notranslate\">Field.rel</code>. The latter is an instance of\n<code class=\"docutils literal notranslate\">django.db.models.fields.related.ForeignObjectRel</code> which replaces\n<code class=\"docutils literal notranslate\">django.db.models.related.RelatedObject</code>. The <code class=\"docutils literal notranslate\">django.db.models.related</code>\nmodule has been removed and the <code class=\"docutils literal notranslate\">Field.related</code> attribute will be removed in\nDjango 1.10.</p>\n</section>\n<section id=\"ssi-template-tag\">\n<h3><code class=\"docutils literal notranslate\">ssi</code> template tag<a class=\"heading-anchor\" href=\"#ssi-template-tag\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">ssi</code> template tag allows files to be included in a template by\nabsolute path. This is of limited use in most deployment situations, and\nthe <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> tag often makes more sense. This tag is now deprecated and\nwill be removed in Django 1.10.</p>\n</section>\n<section id=\"as-comparison-operator-in-if-template-tag\">\n<h3><code class=\"docutils literal notranslate\">=</code> as comparison operator in <code class=\"docutils literal notranslate\">if</code> template tag<a class=\"heading-anchor\" href=\"#as-comparison-operator-in-if-template-tag\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Using a single equals sign with the <code class=\"docutils literal notranslate\">{% if %}</code> template tag for equality\ntesting was undocumented and untested. It’s now deprecated in favor of <code class=\"docutils literal notranslate\">==</code>.</p>\n</section>\n<section id=\"foo-s-syntax-in-modelformmixin-success-url\">\n<h3><code class=\"docutils literal notranslate\">%(&lt;foo&gt;)s</code> syntax in <code class=\"docutils literal notranslate\">ModelFormMixin.success_url</code><a class=\"heading-anchor\" href=\"#foo-s-syntax-in-modelformmixin-success-url\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The legacy <code class=\"docutils literal notranslate\">%(&lt;foo&gt;)s</code> syntax in <a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/mixins-editing/#django.views.generic.edit.ModelFormMixin.success_url\" title=\"django.views.generic.edit.ModelFormMixin.success_url\"><code class=\"xref py py-attr docutils literal notranslate\">ModelFormMixin.success_url</code></a> is deprecated and\nwill be removed in Django 1.10.</p>\n</section>\n<section id=\"geoqueryset-aggregate-methods\">\n<h3><code class=\"docutils literal notranslate\">GeoQuerySet</code> aggregate methods<a class=\"heading-anchor\" href=\"#geoqueryset-aggregate-methods\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">collect()</code>, <code class=\"docutils literal notranslate\">extent()</code>, <code class=\"docutils literal notranslate\">extent3d()</code>, <code class=\"docutils literal notranslate\">make_line()</code>, and\n<code class=\"docutils literal notranslate\">unionagg()</code> aggregate methods are deprecated and should be replaced by their\nfunction-based aggregate equivalents (<code class=\"docutils literal notranslate\">Collect</code>, <code class=\"docutils literal notranslate\">Extent</code>, <code class=\"docutils literal notranslate\">Extent3D</code>,\n<code class=\"docutils literal notranslate\">MakeLine</code>, and <code class=\"docutils literal notranslate\">Union</code>).</p>\n</section>\n<section id=\"signature-of-the-allow-migrate-router-method\">\n<span id=\"deprecated-signature-of-allow-migrate\"></span><h3>Signature of the <code class=\"docutils literal notranslate\">allow_migrate</code> router method<a class=\"heading-anchor\" href=\"#signature-of-the-allow-migrate-router-method\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The signature of the <a class=\"reference internal\" href=\"/en/dev/topics/db/multi-db/#allow_migrate\" title=\"allow_migrate\"><code class=\"xref py py-meth docutils literal notranslate\">allow_migrate()</code></a> method of database routers has\nchanged from <code class=\"docutils literal notranslate\">allow_migrate(db, model)</code> to\n<code class=\"docutils literal notranslate\">allow_migrate(db, app_label, model_name=None, **hints)</code>.</p>\n<p>When <code class=\"docutils literal notranslate\">model_name</code> is set, the value that was previously given through the\n<code class=\"docutils literal notranslate\">model</code> positional argument may now be found inside the <code class=\"docutils literal notranslate\">hints</code> dictionary\nunder the key <code class=\"docutils literal notranslate\">'model'</code>.</p>\n<p>After switching to the new signature the router will also be called by the\n<a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunPython\" title=\"django.db.migrations.operations.RunPython\"><code class=\"xref py py-class docutils literal notranslate\">RunPython</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/migration-operations/#django.db.migrations.operations.RunSQL\" title=\"django.db.migrations.operations.RunSQL\"><code class=\"xref py py-class docutils literal notranslate\">RunSQL</code></a> operations.</p>\n</section>\n</section>\n<section id=\"features-removed-in-1-8\">\n<span id=\"removed-features-1-8\"></span><h2>Features removed in 1.8<a class=\"heading-anchor\" href=\"#features-removed-in-1-8\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>These features have reached the end of their deprecation cycle and are removed\nin Django 1.8. See <a class=\"reference internal\" href=\"/en/dev/releases/1.6/#deprecated-features-1-6\"><span class=\"std std-ref\">Features deprecated in 1.6</span></a> for details, including how to\nremove usage of these features.</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.contrib.comments</code> is removed.</p></li>\n<li><p>The following transaction management APIs are removed:</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">TransactionMiddleware</code></p></li>\n<li><p>the decorators and context managers <code class=\"docutils literal notranslate\">autocommit</code>, <code class=\"docutils literal notranslate\">commit_on_success</code>,\nand <code class=\"docutils literal notranslate\">commit_manually</code>, defined in <code class=\"docutils literal notranslate\">django.db.transaction</code></p></li>\n<li><p>the functions <code class=\"docutils literal notranslate\">commit_unless_managed</code> and <code class=\"docutils literal notranslate\">rollback_unless_managed</code>,\nalso defined in <code class=\"docutils literal notranslate\">django.db.transaction</code></p></li>\n<li><p>the <code class=\"docutils literal notranslate\">TRANSACTIONS_MANAGED</code> setting</p></li>\n</ul>\n</li>\n<li><p>The <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> and <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-firstof\"><code class=\"xref std std-ttag docutils literal notranslate\">firstof</code></a> template tags auto-escape their\narguments.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">SEND_BROKEN_LINK_EMAILS</code> setting is removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.middleware.doc.XViewMiddleware</code> is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">Model._meta.module_name</code> alias is removed.</p></li>\n<li><p>The backward compatible shims introduced to rename <code class=\"docutils literal notranslate\">get_query_set</code>\nand similar queryset methods are removed. This affects the following classes:\n<code class=\"docutils literal notranslate\">BaseModelAdmin</code>, <code class=\"docutils literal notranslate\">ChangeList</code>, <code class=\"docutils literal notranslate\">BaseCommentNode</code>,\n<code class=\"docutils literal notranslate\">GenericForeignKey</code>, <code class=\"docutils literal notranslate\">Manager</code>, <code class=\"docutils literal notranslate\">SingleRelatedObjectDescriptor</code> and\n<code class=\"docutils literal notranslate\">ReverseSingleRelatedObjectDescriptor</code>.</p></li>\n<li><p>The backward compatible shims introduced to rename the attributes\n<code class=\"docutils literal notranslate\">ChangeList.root_query_set</code> and <code class=\"docutils literal notranslate\">ChangeList.query_set</code> are removed.</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.views.defaults.shortcut</code> and <code class=\"docutils literal notranslate\">django.conf.urls.shortcut</code> are\nremoved.</p></li>\n<li><p>Support for the Python Imaging Library (PIL) module is removed.</p></li>\n<li><p>The following private APIs are removed:</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.db.backend</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.close_connection()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.backends.creation.BaseDatabaseCreation.set_autocommit()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.transaction.is_managed()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.transaction.managed()</code></p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">django.forms.widgets.RadioInput</code> is removed.</p></li>\n<li><p>The module <code class=\"docutils literal notranslate\">django.test.simple</code> and the class\n<code class=\"docutils literal notranslate\">django.test.simple.DjangoTestSuiteRunner</code> are removed.</p></li>\n<li><p>The module <code class=\"docutils literal notranslate\">django.test._doctest</code> is removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">CACHE_MIDDLEWARE_ANONYMOUS_ONLY</code> setting is removed. This change\naffects both <code class=\"docutils literal notranslate\">django.middleware.cache.CacheMiddleware</code> and\n<code class=\"docutils literal notranslate\">django.middleware.cache.UpdateCacheMiddleware</code> despite the lack of a\ndeprecation warning in the latter class.</p></li>\n<li><p>Usage of the hardcoded <em>Hold down “Control”, or “Command” on a Mac, to select\nmore than one.</em> string to override or append to user-provided <code class=\"docutils literal notranslate\">help_text</code>\nin forms for <code class=\"docutils literal notranslate\">ManyToMany</code> model fields is not performed by Django anymore\neither at the model or forms layer.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">Model._meta.get_(add|change|delete)_permission</code> methods are removed.</p></li>\n<li><p>The session key <code class=\"docutils literal notranslate\">django_language</code> is no longer read for backwards\ncompatibility.</p></li>\n<li><p>Geographic Sitemaps are removed\n(<code class=\"docutils literal notranslate\">django.contrib.gis.sitemaps.views.index</code> and\n<code class=\"docutils literal notranslate\">django.contrib.gis.sitemaps.views.sitemap</code>).</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.html.fix_ampersands</code>, the <code class=\"docutils literal notranslate\">fix_ampersands</code> template filter,\nand <code class=\"docutils literal notranslate\">django.utils.html.clean_html</code> are removed.</p></li>\n</ul>\n</section>","rootId":"django-1-8-release-notes","toc":[{"title":"Python compatibility","anchor":"python-compatibility","children":[]},{"title":"What’s new in Django 1.8","anchor":"what-s-new-in-django-1-8","children":[{"title":"Model._meta API","anchor":"model-meta-api","children":[]},{"title":"Multiple template engines","anchor":"multiple-template-engines","children":[]},{"title":"Security enhancements","anchor":"security-enhancements","children":[]},{"title":"New PostgreSQL specific functionality","anchor":"new-postgresql-specific-functionality","children":[]},{"title":"New data types","anchor":"new-data-types","children":[]},{"title":"Query Expressions, Conditional Expressions, and Database Functions","anchor":"query-expressions-conditional-expressions-and-database-functions","children":[]},{"title":"TestCase data setup","anchor":"testcase-data-setup","children":[]},{"title":"Minor features","anchor":"minor-features","children":[{"title":"django.contrib.admin","anchor":"django-contrib-admin","children":[]},{"title":"django.contrib.admindocs","anchor":"django-contrib-admindocs","children":[]},{"title":"django.contrib.auth","anchor":"django-contrib-auth","children":[]},{"title":"django.contrib.gis","anchor":"django-contrib-gis","children":[]},{"title":"django.contrib.sessions","anchor":"django-contrib-sessions","children":[]},{"title":"django.contrib.sitemaps","anchor":"django-contrib-sitemaps","children":[]},{"title":"django.contrib.sites","anchor":"django-contrib-sites","children":[]},{"title":"Cache","anchor":"cache","children":[]},{"title":"Cryptography","anchor":"cryptography","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":"Generic Views","anchor":"generic-views","children":[]},{"title":"Internationalization","anchor":"internationalization","children":[]},{"title":"Logging","anchor":"logging","children":[]},{"title":"Management Commands","anchor":"management-commands","children":[]},{"title":"Middleware","anchor":"middleware","children":[]},{"title":"Migrations","anchor":"migrations","children":[]},{"title":"Models","anchor":"models","children":[]},{"title":"Signals","anchor":"signals","children":[]},{"title":"System Check Framework","anchor":"system-check-framework","children":[]},{"title":"Templates","anchor":"templates","children":[]},{"title":"Requests and Responses","anchor":"requests-and-responses","children":[]},{"title":"Tests","anchor":"tests","children":[]},{"title":"Validators","anchor":"validators","children":[]}]}]},{"title":"Backwards incompatible changes in 1.8","anchor":"backwards-incompatible-changes-in-1-8","children":[{"title":"Related object operations are run in a transaction","anchor":"related-object-operations-are-run-in-a-transaction","children":[]},{"title":"Assigning unsaved objects to relations raises an error","anchor":"assigning-unsaved-objects-to-relations-raises-an-error","children":[]},{"title":"Management commands that only accept positional arguments","anchor":"management-commands-that-only-accept-positional-arguments","children":[]},{"title":"Custom test management command arguments through test runner","anchor":"custom-test-management-command-arguments-through-test-runner","children":[]},{"title":"Model check ensures auto-generated column names are within limits specified by database","anchor":"model-check-ensures-auto-generated-column-names-are-within-limits-specified-by-database","children":[]},{"title":"Query relation lookups now check object types","anchor":"query-relation-lookups-now-check-object-types","children":[]},{"title":"select_related() now checks given fields","anchor":"select-related-now-checks-given-fields","children":[]},{"title":"Default EmailField.max_length increased to 254","anchor":"default-emailfield-max-length-increased-to-254","children":[]},{"title":"Support for PostgreSQL versions older than 9.0","anchor":"support-for-postgresql-versions-older-than-9-0","children":[]},{"title":"Support for MySQL versions older than 5.5","anchor":"support-for-mysql-versions-older-than-5-5","children":[]},{"title":"Support for Oracle versions older than 11.1","anchor":"support-for-oracle-versions-older-than-11-1","children":[]},{"title":"Specific privileges used instead of roles for tests on Oracle","anchor":"specific-privileges-used-instead-of-roles-for-tests-on-oracle","children":[]},{"title":"AbstractUser.last_login allows null values","anchor":"abstractuser-last-login-allows-null-values","children":[]},{"title":"django.contrib.gis","anchor":"id1","children":[]},{"title":"Priority of context processors for TemplateResponse brought in line with render","anchor":"priority-of-context-processors-for-templateresponse-brought-in-line-with-render","children":[]},{"title":"Overriding setUpClass / tearDownClass in test cases","anchor":"overriding-setupclass-teardownclass-in-test-cases","children":[]},{"title":"Removal of django.contrib.formtools","anchor":"removal-of-django-contrib-formtools","children":[]},{"title":"Database connection reloading between tests","anchor":"database-connection-reloading-between-tests","children":[]},{"title":"Cleanup of the django.template namespace","anchor":"cleanup-of-the-django-template-namespace","children":[]},{"title":"model attribute on private model relations","anchor":"model-attribute-on-private-model-relations","children":[]},{"title":"Database backend API","anchor":"database-backend-api","children":[]},{"title":"django.contrib.admin","anchor":"id2","children":[]},{"title":"Default autoescaping of functions in django.template.defaultfilters","anchor":"default-autoescaping-of-functions-in-django-template-defaultfilters","children":[]},{"title":"Miscellaneous","anchor":"miscellaneous","children":[]}]},{"title":"Features deprecated in 1.8","anchor":"features-deprecated-in-1-8","children":[{"title":"Selected methods in django.db.models.options.Options","anchor":"selected-methods-in-django-db-models-options-options","children":[]},{"title":"Loading cycle and firstof template tags from future library","anchor":"loading-cycle-and-firstof-template-tags-from-future-library","children":[]},{"title":"django.conf.urls.patterns()","anchor":"django-conf-urls-patterns","children":[]},{"title":"Passing a string as view to django.conf.urls.url()","anchor":"passing-a-string-as-view-to-django-conf-urls-url","children":[]},{"title":"Template-related settings","anchor":"template-related-settings","children":[]},{"title":"django.core.context_processors","anchor":"django-core-context-processors","children":[]},{"title":"django.test.SimpleTestCase.urls","anchor":"django-test-simpletestcase-urls","children":[]},{"title":"prefix argument to i18n_patterns()","anchor":"prefix-argument-to-i18n-patterns","children":[]},{"title":"Using an incorrect count of unpacked values in the for template tag","anchor":"using-an-incorrect-count-of-unpacked-values-in-the-for-template-tag","children":[]},{"title":"Passing a dotted path to reverse() and url","anchor":"passing-a-dotted-path-to-reverse-and-url","children":[]},{"title":"Aggregate methods and modules","anchor":"aggregate-methods-and-modules","children":[]},{"title":"Extending management command arguments through Command.option_list","anchor":"extending-management-command-arguments-through-command-option-list","children":[]},{"title":"django.core.management.NoArgsCommand","anchor":"django-core-management-noargscommand","children":[]},{"title":"Listing all migrations in a project","anchor":"listing-all-migrations-in-a-project","children":[]},{"title":"cache_choices option of ModelChoiceField and ModelMultipleChoiceField","anchor":"cache-choices-option-of-modelchoicefield-and-modelmultiplechoicefield","children":[]},{"title":"django.template.resolve_variable()","anchor":"django-template-resolve-variable","children":[]},{"title":"django.contrib.webdesign","anchor":"django-contrib-webdesign","children":[]},{"title":"error_message argument to django.forms.RegexField","anchor":"error-message-argument-to-django-forms-regexfield","children":[]},{"title":"Old unordered_list syntax","anchor":"old-unordered-list-syntax","children":[]},{"title":"django.forms.Field._has_changed()","anchor":"django-forms-field-has-changed","children":[]},{"title":"django.utils.html.remove_tags() and removetags template filter","anchor":"django-utils-html-remove-tags-and-removetags-template-filter","children":[]},{"title":"is_admin_site argument to django.contrib.auth.views.password_reset()","anchor":"is-admin-site-argument-to-django-contrib-auth-views-password-reset","children":[]},{"title":"SubfieldBase","anchor":"subfieldbase","children":[]},{"title":"django.utils.checksums","anchor":"django-utils-checksums","children":[]},{"title":"InlineAdminForm.original_content_type_id","anchor":"inlineadminform-original-content-type-id","children":[]},{"title":"django.views.generic.edit.FormMixin.get_form()’s form_class argument","anchor":"django-views-generic-edit-formmixin-get-form-s-form-class-argument","children":[]},{"title":"Rendering templates loaded by get_template() with a Context","anchor":"rendering-templates-loaded-by-get-template-with-a-context","children":[]},{"title":"Template and Context classes in template responses","anchor":"template-and-context-classes-in-template-responses","children":[]},{"title":"current_app argument of template-related APIs","anchor":"current-app-argument-of-template-related-apis","children":[]},{"title":"dictionary and context_instance arguments of rendering functions","anchor":"dictionary-and-context-instance-arguments-of-rendering-functions","children":[]},{"title":"dirs argument of template-finding functions","anchor":"dirs-argument-of-template-finding-functions","children":[]},{"title":"django.template.loader.BaseLoader","anchor":"django-template-loader-baseloader","children":[]},{"title":"django.test.utils.TestTemplateLoader","anchor":"django-test-utils-testtemplateloader","children":[]},{"title":"Support for the max_length argument on custom Storage classes","anchor":"support-for-the-max-length-argument-on-custom-storage-classes","children":[]},{"title":"qn replaced by compiler","anchor":"qn-replaced-by-compiler","children":[]},{"title":"Default value of RedirectView.permanent","anchor":"default-value-of-redirectview-permanent","children":[]},{"title":"Using AuthenticationMiddleware without SessionAuthenticationMiddleware","anchor":"using-authenticationmiddleware-without-sessionauthenticationmiddleware","children":[]},{"title":"django.contrib.sitemaps.FlatPageSitemap","anchor":"django-contrib-sitemaps-flatpagesitemap","children":[]},{"title":"Model Field.related","anchor":"model-field-related","children":[]},{"title":"ssi template tag","anchor":"ssi-template-tag","children":[]},{"title":"= as comparison operator in if template tag","anchor":"as-comparison-operator-in-if-template-tag","children":[]},{"title":"%(<foo>)s syntax in ModelFormMixin.success_url","anchor":"foo-s-syntax-in-modelformmixin-success-url","children":[]},{"title":"GeoQuerySet aggregate methods","anchor":"geoqueryset-aggregate-methods","children":[]},{"title":"Signature of the allow_migrate router method","anchor":"signature-of-the-allow-migrate-router-method","children":[]}]},{"title":"Features removed in 1.8","anchor":"features-removed-in-1-8","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.8.1","title":"Django 1.8.1 release notes","url":"/en/dev/releases/1.8.1/"},"next":{"docname":"releases/1.7.11","title":"Django 1.7.11 release notes","url":"/en/dev/releases/1.7.11/"},"formats":{"html":"/en/dev/releases/1.8/","markdown":"/en/dev/releases/1.8.md","json":"/en/dev/releases/1.8.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.8.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.8/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9","1.8"],"inLocales":["en"]}