Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > 3f388dbb5c0ba9abe7c510467d6cc65d > files > 906

python-django-doc-1.8.19-1.1.mga6.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" lang="">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Django 1.8 release notes &#8212; Django 1.8.19 documentation</title>
    
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.8.19',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="top" title="Django 1.8.19 documentation" href="../contents.html" />
    <link rel="up" title="Release notes" href="index.html" />
    <link rel="next" title="Django 1.7.11 release notes" href="1.7.11.html" />
    <link rel="prev" title="Django 1.8.1 release notes" href="1.8.1.html" />



 
<script type="text/javascript" src="../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../ref/templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>


  </head>
  <body role="document">

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../index.html">Django 1.8.19 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../index.html">Home</a>  |
        <a title="Table of contents" href="../contents.html">Table of contents</a>  |
        <a title="Global index" href="../genindex.html">Index</a>  |
        <a title="Module index" href="../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="1.8.1.html" title="Django 1.8.1 release notes">previous</a>
     |
    <a href="index.html" title="Release notes" accesskey="U">up</a>
   |
    <a href="1.7.11.html" title="Django 1.7.11 release notes">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="releases-1.8">
            
  <div class="section" id="s-django-1-8-release-notes">
<span id="django-1-8-release-notes"></span><h1>Django 1.8 release notes<a class="headerlink" href="#django-1-8-release-notes" title="Permalink to this headline">¶</a></h1>
<p><em>April 1, 2015</em></p>
<p>Welcome to Django 1.8!</p>
<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
some <a class="reference internal" href="#backwards-incompatible-1-8"><span class="std std-ref">backwards incompatible changes</span></a> you&#8217;ll
want to be aware of when upgrading from Django 1.7 or older versions. We&#8217;ve
also <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
deprecation process and <a class="reference internal" href="#removed-features-1-8"><span class="std std-ref">have been removed</span></a>.</p>
<p>Django 1.8 has been designated as Django&#8217;s second <a class="reference internal" href="../internals/release-process.html#lts-releases"><span class="std std-ref">&#8220;Long-Term Support&#8221;
(LTS)</span></a> release. It will receive security updates for at least
three years after its release. Support for the previous LTS, Django 1.4, will
end 6 months from the release date of Django 1.8.</p>
<div class="section" id="s-python-compatibility">
<span id="python-compatibility"></span><h2>Python compatibility<a class="headerlink" href="#python-compatibility" title="Permalink to this headline">¶</a></h2>
<p>Django 1.8 requires Python 2.7, 3.2, 3.3, 3.4, or 3.5. We <strong>highly recommend</strong>
and only officially support the latest release of each series.</p>
<p>Django 1.8 is the first release to support Python 3.5.</p>
<p>Due to the end of upstream support for Python 3.2 in February 2016, we won&#8217;t
test Django 1.8.x on Python 3.2 after the end of 2016.</p>
</div>
<div class="section" id="s-what-s-new-in-django-1-8">
<span id="s-whats-new-1-8"></span><span id="what-s-new-in-django-1-8"></span><span id="whats-new-1-8"></span><h2>What&#8217;s new in Django 1.8<a class="headerlink" href="#what-s-new-in-django-1-8" title="Permalink to this headline">¶</a></h2>
<div class="section" id="s-model-meta-api">
<span id="model-meta-api"></span><h3><code class="docutils literal"><span class="pre">Model._meta</span></code> API<a class="headerlink" href="#model-meta-api" title="Permalink to this headline">¶</a></h3>
<p>Django now has a formalized API for <a class="reference internal" href="../ref/models/meta.html"><span class="doc">Model._meta</span></a>,
providing an officially supported way to <a class="reference internal" href="../ref/models/meta.html#model-meta-field-api"><span class="std std-ref">retrieve fields</span></a> and filter fields based on their <a class="reference internal" href="../ref/models/fields.html#model-field-attributes"><span class="std std-ref">attributes</span></a>.</p>
<p>The <code class="docutils literal"><span class="pre">Model._meta</span></code> object has been part of Django since the days of pre-0.96
&#8220;Magic Removal&#8221; &#8211; it just wasn&#8217;t an official, stable API. In recognition of
this, we&#8217;ve endeavored to maintain backwards-compatibility with the old
API endpoint where possible. However, API endpoints that aren&#8217;t part of the
new official API have been deprecated and will eventually be removed. A
<a class="reference internal" href="../ref/models/meta.html#migrating-old-meta-api"><span class="std std-ref">guide to migrating from the old API to the new API</span></a> has been provided.</p>
</div>
<div class="section" id="s-multiple-template-engines">
<span id="multiple-template-engines"></span><h3>Multiple template engines<a class="headerlink" href="#multiple-template-engines" title="Permalink to this headline">¶</a></h3>
<p>Django 1.8 defines a stable API for integrating template backends. It includes
built-in support for the Django template language and for
<a class="reference internal" href="../topics/templates.html#django.template.backends.jinja2.Jinja2" title="django.template.backends.jinja2.Jinja2"><code class="xref py py-class docutils literal"><span class="pre">Jinja2</span></code></a>. It supports rendering
templates with multiple engines within the same project. Learn more about the
new features in the <a class="reference internal" href="../topics/templates.html"><span class="doc">topic guide</span></a> and check the
<a class="reference internal" href="../ref/templates/upgrading.html"><span class="doc">upgrade instructions</span></a> for details.</p>
</div>
<div class="section" id="s-security-enhancements">
<span id="security-enhancements"></span><h3>Security enhancements<a class="headerlink" href="#security-enhancements" title="Permalink to this headline">¶</a></h3>
<p>Several features of the <a class="reference external" href="https://pypi.python.org/pypi/django-secure">django-secure</a> third-party library have been
integrated into Django. <a class="reference internal" href="../ref/middleware.html#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal"><span class="pre">django.middleware.security.SecurityMiddleware</span></code></a>
provides several security enhancements to the request/response cycle. The new
<a class="reference internal" href="../ref/django-admin.html#django-admin-option---deploy"><code class="xref std std-djadminopt docutils literal"><span class="pre">--deploy</span></code></a> option of the <a class="reference internal" href="../ref/django-admin.html#django-admin-check"><code class="xref std std-djadmin docutils literal"><span class="pre">check</span></code></a> command allows you to
check your production settings file for ways to increase the security of your
site.</p>
</div>
<div class="section" id="s-new-postgresql-specific-functionality">
<span id="new-postgresql-specific-functionality"></span><h3>New PostgreSQL specific functionality<a class="headerlink" href="#new-postgresql-specific-functionality" title="Permalink to this headline">¶</a></h3>
<p>Django now has a module with extensions for PostgreSQL specific features, such
as <a class="reference internal" href="../ref/contrib/postgres/fields.html#django.contrib.postgres.fields.ArrayField" title="django.contrib.postgres.fields.ArrayField"><code class="xref py py-class docutils literal"><span class="pre">ArrayField</span></code></a>,
<a class="reference internal" href="../ref/contrib/postgres/fields.html#django.contrib.postgres.fields.HStoreField" title="django.contrib.postgres.fields.HStoreField"><code class="xref py py-class docutils literal"><span class="pre">HStoreField</span></code></a>, <a class="reference internal" href="../ref/contrib/postgres/fields.html#range-fields"><span class="std std-ref">Range Fields</span></a>, and
<a class="reference internal" href="../ref/contrib/postgres/lookups.html#std:fieldlookup-unaccent"><code class="xref std std-lookup docutils literal"><span class="pre">unaccent</span></code></a> lookup. A full breakdown of the features is available
<a class="reference internal" href="../ref/contrib/postgres/index.html"><span class="doc">in the documentation</span></a>.</p>
</div>
<div class="section" id="s-new-data-types">
<span id="new-data-types"></span><h3>New data types<a class="headerlink" href="#new-data-types" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>Django now has a <a class="reference internal" href="../ref/models/fields.html#django.db.models.UUIDField" title="django.db.models.UUIDField"><code class="xref py py-class docutils literal"><span class="pre">UUIDField</span></code></a> for storing
universally unique identifiers. It is stored as the native <code class="docutils literal"><span class="pre">uuid</span></code> data type
on PostgreSQL and as a fixed length character field on other backends. There
is a corresponding <a class="reference internal" href="../ref/forms/fields.html#django.forms.UUIDField" title="django.forms.UUIDField"><code class="xref py py-class docutils literal"><span class="pre">form</span> <span class="pre">field</span></code></a>.</li>
<li>Django now has a <a class="reference internal" href="../ref/models/fields.html#django.db.models.DurationField" title="django.db.models.DurationField"><code class="xref py py-class docutils literal"><span class="pre">DurationField</span></code></a> for storing periods
of time - modeled in Python by <code class="xref py py-class docutils literal"><span class="pre">timedelta</span></code>. It is
stored in the native <code class="docutils literal"><span class="pre">interval</span></code> data type on PostgreSQL, as a <code class="docutils literal"><span class="pre">INTERVAL</span>
<span class="pre">DAY(9)</span> <span class="pre">TO</span> <span class="pre">SECOND(6)</span></code> on Oracle, and as a <code class="docutils literal"><span class="pre">bigint</span></code> of microseconds on other
backends. Date and time related arithmetic has also been improved on all
backends. There is a corresponding <a class="reference internal" href="../ref/forms/fields.html#django.forms.DurationField" title="django.forms.DurationField"><code class="xref py py-class docutils literal"><span class="pre">form</span> <span class="pre">field</span></code></a>.</li>
</ul>
</div>
<div class="section" id="s-query-expressions-conditional-expressions-and-database-functions">
<span id="query-expressions-conditional-expressions-and-database-functions"></span><h3>Query Expressions, Conditional Expressions, and Database Functions<a class="headerlink" href="#query-expressions-conditional-expressions-and-database-functions" title="Permalink to this headline">¶</a></h3>
<p><a class="reference internal" href="../ref/models/expressions.html"><span class="doc">Query Expressions</span></a> allow you to create,
customize, and compose complex SQL expressions. This has enabled annotate
to accept expressions other than aggregates. Aggregates are now able to
reference multiple fields, as well as perform arithmetic, similar to <code class="docutils literal"><span class="pre">F()</span></code>
objects. <a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.order_by" title="django.db.models.query.QuerySet.order_by"><code class="xref py py-meth docutils literal"><span class="pre">order_by()</span></code></a> has also gained the
ability to accept expressions.</p>
<p><a class="reference internal" href="../ref/models/conditional-expressions.html"><span class="doc">Conditional Expressions</span></a> allow
you to use <code class="xref std std-keyword docutils literal"><span class="pre">if</span></code> ... <code class="xref std std-keyword docutils literal"><span class="pre">elif</span></code> ... <code class="xref std std-keyword docutils literal"><span class="pre">else</span></code> logic within
queries.</p>
<p>A collection of <a class="reference internal" href="../ref/models/database-functions.html"><span class="doc">database functions</span></a> is
also included with functionality such as
<a class="reference internal" href="../ref/models/database-functions.html#django.db.models.functions.Coalesce" title="django.db.models.functions.Coalesce"><code class="xref py py-class docutils literal"><span class="pre">Coalesce</span></code></a>,
<a class="reference internal" href="../ref/models/database-functions.html#django.db.models.functions.Concat" title="django.db.models.functions.Concat"><code class="xref py py-class docutils literal"><span class="pre">Concat</span></code></a>, and
<a class="reference internal" href="../ref/models/database-functions.html#django.db.models.functions.Substr" title="django.db.models.functions.Substr"><code class="xref py py-class docutils literal"><span class="pre">Substr</span></code></a>.</p>
</div>
<div class="section" id="s-testcase-data-setup">
<span id="testcase-data-setup"></span><h3><code class="docutils literal"><span class="pre">TestCase</span></code> data setup<a class="headerlink" href="#testcase-data-setup" title="Permalink to this headline">¶</a></h3>
<p><a class="reference internal" href="../topics/testing/tools.html#django.test.TestCase" title="django.test.TestCase"><code class="xref py py-class docutils literal"><span class="pre">TestCase</span></code></a> has been refactored to allow for data
initialization at the class level using transactions and savepoints. Database
backends which do not support transactions, like MySQL with the MyISAM storage
engine, will still be able to run these tests but won&#8217;t benefit from the
improvements. Tests are now run within two nested
<a class="reference internal" href="../topics/db/transactions.html#django.db.transaction.atomic" title="django.db.transaction.atomic"><code class="xref py py-func docutils literal"><span class="pre">atomic()</span></code></a> blocks: one for the whole class and one
for each test.</p>
<ul class="simple">
<li>The class method
<a class="reference internal" href="../topics/testing/tools.html#django.test.TestCase.setUpTestData" title="django.test.TestCase.setUpTestData"><code class="xref py py-meth docutils literal"><span class="pre">TestCase.setUpTestData()</span></code></a> adds
the ability to setup test data at the class level. Using this technique can
speed up the tests as compared to using <code class="docutils literal"><span class="pre">setUp()</span></code>.</li>
<li>Fixture loading within <code class="docutils literal"><span class="pre">TestCase</span></code> is now performed once for the whole
<code class="docutils literal"><span class="pre">TestCase</span></code>.</li>
</ul>
</div>
<div class="section" id="s-minor-features">
<span id="minor-features"></span><h3>Minor features<a class="headerlink" href="#minor-features" title="Permalink to this headline">¶</a></h3>
<div class="section" id="s-django-contrib-admin">
<span id="django-contrib-admin"></span><h4><a class="reference internal" href="../ref/contrib/admin/index.html#module-django.contrib.admin" title="django.contrib.admin: Django's admin site."><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.admin</span></code></a><a class="headerlink" href="#django-contrib-admin" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin" title="django.contrib.admin.ModelAdmin"><code class="xref py py-class docutils literal"><span class="pre">ModelAdmin</span></code></a> now has a
<a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.has_module_permission" title="django.contrib.admin.ModelAdmin.has_module_permission"><code class="xref py py-meth docutils literal"><span class="pre">has_module_permission()</span></code></a>
method to allow limiting access to the module on the admin index page.</li>
<li><a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.InlineModelAdmin" title="django.contrib.admin.InlineModelAdmin"><code class="xref py py-class docutils literal"><span class="pre">InlineModelAdmin</span></code></a> now has an attribute
<a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.InlineModelAdmin.show_change_link" title="django.contrib.admin.InlineModelAdmin.show_change_link"><code class="xref py py-attr docutils literal"><span class="pre">show_change_link</span></code></a> that
supports showing a link to an inline object&#8217;s change form.</li>
<li>Use the new <code class="docutils literal"><span class="pre">django.contrib.admin.RelatedOnlyFieldListFilter</span></code> in
<a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_filter" title="django.contrib.admin.ModelAdmin.list_filter"><code class="xref py py-attr docutils literal"><span class="pre">ModelAdmin.list_filter</span></code></a>
to limit the <code class="docutils literal"><span class="pre">list_filter</span></code> choices to foreign objects which are attached to
those from the <code class="docutils literal"><span class="pre">ModelAdmin</span></code>.</li>
<li>The <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.delete_view" title="django.contrib.admin.ModelAdmin.delete_view"><code class="xref py py-meth docutils literal"><span class="pre">ModelAdmin.delete_view()</span></code></a> displays a summary of objects
to be deleted on the deletion confirmation page.</li>
<li>The jQuery library embedded in the admin has been upgraded to version 1.11.2.</li>
<li>You can now specify <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.site_url" title="django.contrib.admin.AdminSite.site_url"><code class="xref py py-attr docutils literal"><span class="pre">AdminSite.site_url</span></code></a> in order to display a link to the
front-end site.</li>
<li>You can now specify <a class="reference internal" href="../ref/contrib/admin/index.html#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"><span class="pre">ModelAdmin.show_full_result_count</span></code></a> to control whether
or not the full count of objects should be displayed on a filtered admin page.</li>
<li>The <code class="docutils literal"><span class="pre">AdminSite.password_change()</span></code> method now has an <code class="docutils literal"><span class="pre">extra_context</span></code>
parameter.</li>
<li>You can now control who may login to the admin site by overriding only
<a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.has_permission" title="django.contrib.admin.AdminSite.has_permission"><code class="xref py py-meth docutils literal"><span class="pre">AdminSite.has_permission()</span></code></a> and
<a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.login_form" title="django.contrib.admin.AdminSite.login_form"><code class="xref py py-attr docutils literal"><span class="pre">AdminSite.login_form</span></code></a>.
The <code class="docutils literal"><span class="pre">base.html</span></code> template has a new block <code class="docutils literal"><span class="pre">usertools</span></code> which contains the
user-specific header. A new context variable <code class="docutils literal"><span class="pre">has_permission</span></code>, which gets
its value from <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.has_permission" title="django.contrib.admin.AdminSite.has_permission"><code class="xref py py-meth docutils literal"><span class="pre">has_permission()</span></code></a>,
indicates whether the user may access the site.</li>
<li>Foreign key dropdowns now have buttons for changing or deleting related
objects using a popup.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-admindocs">
<span id="django-contrib-admindocs"></span><h4><a class="reference internal" href="../ref/contrib/admin/admindocs.html#module-django.contrib.admindocs" title="django.contrib.admindocs: Django's admin documentation generator."><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.admindocs</span></code></a><a class="headerlink" href="#django-contrib-admindocs" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>reStructuredText is now parsed in model docstrings.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-auth">
<span id="django-contrib-auth"></span><h4><a class="reference internal" href="../topics/auth/index.html#module-django.contrib.auth" title="django.contrib.auth: Django's authentication framework."><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.auth</span></code></a><a class="headerlink" href="#django-contrib-auth" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Authorization backends can now raise
<a class="reference internal" href="../ref/exceptions.html#django.core.exceptions.PermissionDenied" title="django.core.exceptions.PermissionDenied"><code class="xref py py-class docutils literal"><span class="pre">PermissionDenied</span></code></a> in
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.User.has_perm" title="django.contrib.auth.models.User.has_perm"><code class="xref py py-meth docutils literal"><span class="pre">has_perm()</span></code></a>
and <a class="reference internal" href="../ref/contrib/auth.html#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"><span class="pre">has_module_perms()</span></code></a>
to short-circuit permission checking.</li>
<li><a class="reference internal" href="../topics/auth/default.html#django.contrib.auth.forms.PasswordResetForm" title="django.contrib.auth.forms.PasswordResetForm"><code class="xref py py-class docutils literal"><span class="pre">PasswordResetForm</span></code></a> now
has a method <a class="reference internal" href="../topics/auth/default.html#django.contrib.auth.forms.PasswordResetForm.send_mail" title="django.contrib.auth.forms.PasswordResetForm.send_mail"><code class="xref py py-meth docutils literal"><span class="pre">send_mail()</span></code></a>
that can be overridden to customize the mail to be sent.</li>
<li>The <code class="docutils literal"><span class="pre">max_length</span></code> of <a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.Permission.name" title="django.contrib.auth.models.Permission.name"><code class="xref py py-attr docutils literal"><span class="pre">Permission.name</span></code></a> has been increased from 50 to
255 characters. Please run the database migration.</li>
<li><a class="reference internal" href="../topics/auth/customizing.html#django.contrib.auth.models.CustomUser.USERNAME_FIELD" title="django.contrib.auth.models.CustomUser.USERNAME_FIELD"><code class="xref py py-attr docutils literal"><span class="pre">USERNAME_FIELD</span></code></a> and
<a class="reference internal" href="../topics/auth/customizing.html#django.contrib.auth.models.CustomUser.REQUIRED_FIELDS" title="django.contrib.auth.models.CustomUser.REQUIRED_FIELDS"><code class="xref py py-attr docutils literal"><span class="pre">REQUIRED_FIELDS</span></code></a> now supports
<a class="reference internal" href="../ref/models/fields.html#django.db.models.ForeignKey" title="django.db.models.ForeignKey"><code class="xref py py-class docutils literal"><span class="pre">ForeignKey</span></code></a>s.</li>
<li>The default iteration count for the PBKDF2 password hasher has been
increased by 33%. This backwards compatible change will not affect users who
have subclassed <code class="docutils literal"><span class="pre">django.contrib.auth.hashers.PBKDF2PasswordHasher</span></code> to
change the default value.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-gis">
<span id="django-contrib-gis"></span><h4><a class="reference internal" href="../ref/contrib/gis/index.html#module-django.contrib.gis" title="django.contrib.gis: Geographic Information System (GIS) extensions for Django"><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.gis</span></code></a><a class="headerlink" href="#django-contrib-gis" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>A new <a class="reference internal" href="../ref/contrib/gis/serializers.html"><span class="doc">GeoJSON serializer</span></a> is now
available.</li>
<li>It is now allowed to include a subquery as a geographic lookup argument, for
example <code class="docutils literal"><span class="pre">City.objects.filter(point__within=Country.objects.filter(continent='Africa').values('mpoly'))</span></code>.</li>
<li>The Spatialite backend now supports <code class="docutils literal"><span class="pre">Collect</span></code> and <code class="docutils literal"><span class="pre">Extent</span></code> aggregates
when the database version is 3.0 or later.</li>
<li>The PostGIS 2 <code class="docutils literal"><span class="pre">CREATE</span> <span class="pre">EXTENSION</span> <span class="pre">postgis</span></code> and the Spatialite
<code class="docutils literal"><span class="pre">SELECT</span> <span class="pre">InitSpatialMetaData</span></code> initialization commands are now automatically
run by <a class="reference internal" href="../ref/django-admin.html#django-admin-migrate"><code class="xref std std-djadmin docutils literal"><span class="pre">migrate</span></code></a>.</li>
<li>The GDAL interface now supports retrieving properties of
<a class="reference internal" href="../ref/contrib/gis/gdal.html#raster-data-source-objects"><span class="std std-ref">raster (image) data file</span></a>.</li>
<li>Compatibility shims for <code class="docutils literal"><span class="pre">SpatialRefSys</span></code> and <code class="docutils literal"><span class="pre">GeometryColumns</span></code> changed in
Django 1.2 have been removed.</li>
<li>All GDAL-related exceptions are now raised with <code class="docutils literal"><span class="pre">GDALException</span></code>. The former
<code class="docutils literal"><span class="pre">OGRException</span></code> has been kept for backwards compatibility but should not be
used any longer.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-sessions">
<span id="django-contrib-sessions"></span><h4><a class="reference internal" href="../topics/http/sessions.html#module-django.contrib.sessions" title="django.contrib.sessions: Provides session management for Django projects."><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.sessions</span></code></a><a class="headerlink" href="#django-contrib-sessions" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Session cookie is now deleted after
<a class="reference internal" href="../topics/http/sessions.html#django.contrib.sessions.backends.base.SessionBase.flush" title="django.contrib.sessions.backends.base.SessionBase.flush"><code class="xref py py-meth docutils literal"><span class="pre">flush()</span></code></a> is called.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-sitemaps">
<span id="django-contrib-sitemaps"></span><h4><a class="reference internal" href="../ref/contrib/sitemaps.html#module-django.contrib.sitemaps" title="django.contrib.sitemaps: A framework for generating Google sitemap XML files."><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.sitemaps</span></code></a><a class="headerlink" href="#django-contrib-sitemaps" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The new <a class="reference internal" href="../ref/contrib/sitemaps.html#django.contrib.sitemaps.Sitemap.i18n" title="django.contrib.sitemaps.Sitemap.i18n"><code class="xref py py-attr docutils literal"><span class="pre">Sitemap.i18n</span></code></a> attribute
allows you to generate a sitemap based on the <a class="reference internal" href="../ref/settings.html#std:setting-LANGUAGES"><code class="xref std std-setting docutils literal"><span class="pre">LANGUAGES</span></code></a> setting.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-sites">
<span id="django-contrib-sites"></span><h4><a class="reference internal" href="../ref/contrib/sites.html#module-django.contrib.sites" title="django.contrib.sites: Lets you operate multiple Web sites from the same database and Django project"><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.sites</span></code></a><a class="headerlink" href="#django-contrib-sites" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/contrib/sites.html#django.contrib.sites.shortcuts.get_current_site" title="django.contrib.sites.shortcuts.get_current_site"><code class="xref py py-func docutils literal"><span class="pre">get_current_site()</span></code></a> will now lookup
the current site based on <a class="reference internal" href="../ref/request-response.html#django.http.HttpRequest.get_host" title="django.http.HttpRequest.get_host"><code class="xref py py-meth docutils literal"><span class="pre">request.get_host()</span></code></a> if the <a class="reference internal" href="../ref/settings.html#std:setting-SITE_ID"><code class="xref std std-setting docutils literal"><span class="pre">SITE_ID</span></code></a> setting is not
defined.</li>
<li>The default <a class="reference internal" href="../ref/contrib/sites.html#django.contrib.sites.models.Site" title="django.contrib.sites.models.Site"><code class="xref py py-class docutils literal"><span class="pre">Site</span></code></a> created when running
<code class="docutils literal"><span class="pre">migrate</span></code> now respects the <a class="reference internal" href="../ref/settings.html#std:setting-SITE_ID"><code class="xref std std-setting docutils literal"><span class="pre">SITE_ID</span></code></a> setting (instead of always
using <code class="docutils literal"><span class="pre">pk=1</span></code>).</li>
</ul>
</div>
<div class="section" id="s-cache">
<span id="cache"></span><h4>Cache<a class="headerlink" href="#cache" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <code class="docutils literal"><span class="pre">incr()</span></code> method of the
<code class="docutils literal"><span class="pre">django.core.cache.backends.locmem.LocMemCache</span></code> backend is now thread-safe.</li>
</ul>
</div>
<div class="section" id="s-cryptography">
<span id="cryptography"></span><h4>Cryptography<a class="headerlink" href="#cryptography" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <code class="docutils literal"><span class="pre">max_age</span></code> parameter of the
<a class="reference internal" href="../topics/signing.html#django.core.signing.TimestampSigner.unsign" title="django.core.signing.TimestampSigner.unsign"><code class="xref py py-meth docutils literal"><span class="pre">django.core.signing.TimestampSigner.unsign()</span></code></a> method now also accepts a
<code class="xref py py-class docutils literal"><span class="pre">datetime.timedelta</span></code> object.</li>
</ul>
</div>
<div class="section" id="s-database-backends">
<span id="database-backends"></span><h4>Database backends<a class="headerlink" href="#database-backends" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The MySQL backend no longer strips microseconds from <code class="docutils literal"><span class="pre">datetime</span></code> values as
MySQL 5.6.4 and up supports fractional seconds depending on the declaration
of the datetime field (when <code class="docutils literal"><span class="pre">DATETIME</span></code> includes fractional precision greater
than 0). New datetime database columns created with Django 1.8 and MySQL 5.6.4
and up will support microseconds. See the <a class="reference internal" href="../ref/databases.html#mysql-fractional-seconds"><span class="std std-ref">MySQL database notes</span></a> for more details.</li>
<li>The MySQL backend no longer creates explicit indexes for foreign keys when
using the InnoDB storage engine, as MySQL already creates them automatically.</li>
<li>The Oracle backend no longer defines the <code class="docutils literal"><span class="pre">connection_persists_old_columns</span></code>
feature as <code class="docutils literal"><span class="pre">True</span></code>. Instead, Oracle will now include a cache busting clause
when getting the description of a table.</li>
</ul>
</div>
<div class="section" id="s-email">
<span id="email"></span><h4>Email<a class="headerlink" href="#email" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../topics/email.html#topic-email-backends"><span class="std std-ref">Email backends</span></a> now support the context manager
protocol for opening and closing connections.</li>
<li>The SMTP email backend now supports <code class="docutils literal"><span class="pre">keyfile</span></code> and <code class="docutils literal"><span class="pre">certfile</span></code>
authentication with the <a class="reference internal" href="../ref/settings.html#std:setting-EMAIL_SSL_CERTFILE"><code class="xref std std-setting docutils literal"><span class="pre">EMAIL_SSL_CERTFILE</span></code></a> and
<a class="reference internal" href="../ref/settings.html#std:setting-EMAIL_SSL_KEYFILE"><code class="xref std std-setting docutils literal"><span class="pre">EMAIL_SSL_KEYFILE</span></code></a> settings.</li>
<li>The SMTP <a class="reference internal" href="../topics/email.html#django.core.mail.backends.smtp.EmailBackend" title="django.core.mail.backends.smtp.EmailBackend"><code class="xref py py-class docutils literal"><span class="pre">EmailBackend</span></code></a> now supports
setting the <code class="docutils literal"><span class="pre">timeout</span></code> parameter with the <a class="reference internal" href="../ref/settings.html#std:setting-EMAIL_TIMEOUT"><code class="xref std std-setting docutils literal"><span class="pre">EMAIL_TIMEOUT</span></code></a> setting.</li>
<li><a class="reference internal" href="../topics/email.html#django.core.mail.EmailMessage" title="django.core.mail.EmailMessage"><code class="xref py py-class docutils literal"><span class="pre">EmailMessage</span></code></a> and <code class="docutils literal"><span class="pre">EmailMultiAlternatives</span></code> now
support the <code class="docutils literal"><span class="pre">reply_to</span></code> parameter.</li>
</ul>
</div>
<div class="section" id="s-file-storage">
<span id="file-storage"></span><h4>File Storage<a class="headerlink" href="#file-storage" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/files/storage.html#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"><span class="pre">Storage.get_available_name()</span></code></a> and
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.save" title="django.core.files.storage.Storage.save"><code class="xref py py-meth docutils literal"><span class="pre">Storage.save()</span></code></a>
now take a <code class="docutils literal"><span class="pre">max_length</span></code> argument to implement storage-level maximum
filename length constraints. Filenames exceeding this argument will get
truncated. This prevents a database error when appending a unique suffix to a
long filename that already exists on the storage. See the <a class="reference internal" href="#storage-max-length-update"><span class="std std-ref">deprecation
note</span></a> about adding this argument to your custom
storage classes.</li>
</ul>
</div>
<div class="section" id="s-forms">
<span id="forms"></span><h4>Forms<a class="headerlink" href="#forms" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Form widgets now render attributes with a value of <code class="docutils literal"><span class="pre">True</span></code> or <code class="docutils literal"><span class="pre">False</span></code>
as HTML5 boolean attributes.</li>
<li>The new <a class="reference internal" href="../ref/forms/api.html#django.forms.Form.has_error" title="django.forms.Form.has_error"><code class="xref py py-meth docutils literal"><span class="pre">has_error()</span></code></a> method allows checking
if a specific error has happened.</li>
<li>If <a class="reference internal" href="../ref/forms/api.html#django.forms.Form.required_css_class" title="django.forms.Form.required_css_class"><code class="xref py py-attr docutils literal"><span class="pre">required_css_class</span></code></a> is defined on a form, then
the <code class="docutils literal"><span class="pre">&lt;label&gt;</span></code> tags for required fields will have this class present in its
attributes.</li>
<li>The rendering of non-field errors in unordered lists (<code class="docutils literal"><span class="pre">&lt;ul&gt;</span></code>) now includes
<code class="docutils literal"><span class="pre">nonfield</span></code> in its list of classes to distinguish them from field-specific
errors.</li>
<li><a class="reference internal" href="../ref/forms/fields.html#django.forms.Field" title="django.forms.Field"><code class="xref py py-class docutils literal"><span class="pre">Field</span></code></a> now accepts a
<a class="reference internal" href="../ref/forms/fields.html#django.forms.Field.label_suffix" title="django.forms.Field.label_suffix"><code class="xref py py-attr docutils literal"><span class="pre">label_suffix</span></code></a> argument, which will override the
form&#8217;s <a class="reference internal" href="../ref/forms/api.html#django.forms.Form.label_suffix" title="django.forms.Form.label_suffix"><code class="xref py py-attr docutils literal"><span class="pre">label_suffix</span></code></a>. This enables customizing the
suffix on a per-field basis — previously it wasn&#8217;t possible to override
a form&#8217;s <a class="reference internal" href="../ref/forms/api.html#django.forms.Form.label_suffix" title="django.forms.Form.label_suffix"><code class="xref py py-attr docutils literal"><span class="pre">label_suffix</span></code></a> while using  shortcuts such
as <code class="docutils literal"><span class="pre">{{</span> <span class="pre">form.as_p</span> <span class="pre">}}</span></code> in templates.</li>
<li><a class="reference internal" href="../ref/forms/widgets.html#django.forms.extras.widgets.SelectDateWidget" title="django.forms.extras.widgets.SelectDateWidget"><code class="xref py py-class docutils literal"><span class="pre">SelectDateWidget</span></code></a> now accepts an
<a class="reference internal" href="../ref/forms/widgets.html#django.forms.extras.widgets.SelectDateWidget.empty_label" title="django.forms.extras.widgets.SelectDateWidget.empty_label"><code class="xref py py-attr docutils literal"><span class="pre">empty_label</span></code></a> argument, which will
override the top list choice label when <a class="reference internal" href="../ref/forms/fields.html#django.forms.DateField" title="django.forms.DateField"><code class="xref py py-class docutils literal"><span class="pre">DateField</span></code></a> is not required.</li>
<li>After an <a class="reference internal" href="../ref/forms/fields.html#django.forms.ImageField" title="django.forms.ImageField"><code class="xref py py-class docutils literal"><span class="pre">ImageField</span></code></a> has been cleaned and validated, the
<code class="docutils literal"><span class="pre">UploadedFile</span></code> object will have an additional <code class="docutils literal"><span class="pre">image</span></code> attribute containing
the Pillow <code class="docutils literal"><span class="pre">Image</span></code> instance used to check if the file was a valid image. It
will also update <code class="docutils literal"><span class="pre">UploadedFile.content_type</span></code> with the image&#8217;s content type
as determined by Pillow.</li>
<li>You can now pass a callable that returns an iterable of choices when
instantiating a <a class="reference internal" href="../ref/forms/fields.html#django.forms.ChoiceField" title="django.forms.ChoiceField"><code class="xref py py-class docutils literal"><span class="pre">ChoiceField</span></code></a>.</li>
</ul>
</div>
<div class="section" id="s-generic-views">
<span id="generic-views"></span><h4>Generic Views<a class="headerlink" href="#generic-views" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Generic views that use <a class="reference internal" href="../ref/class-based-views/mixins-multiple-object.html#django.views.generic.list.MultipleObjectMixin" title="django.views.generic.list.MultipleObjectMixin"><code class="xref py py-class docutils literal"><span class="pre">MultipleObjectMixin</span></code></a>
may now specify the ordering applied to the
<a class="reference internal" href="../ref/class-based-views/mixins-multiple-object.html#django.views.generic.list.MultipleObjectMixin.queryset" title="django.views.generic.list.MultipleObjectMixin.queryset"><code class="xref py py-attr docutils literal"><span class="pre">queryset</span></code></a> by setting
<a class="reference internal" href="../ref/class-based-views/mixins-multiple-object.html#django.views.generic.list.MultipleObjectMixin.ordering" title="django.views.generic.list.MultipleObjectMixin.ordering"><code class="xref py py-attr docutils literal"><span class="pre">ordering</span></code></a> or overriding
<a class="reference internal" href="../ref/class-based-views/mixins-multiple-object.html#django.views.generic.list.MultipleObjectMixin.get_ordering" title="django.views.generic.list.MultipleObjectMixin.get_ordering"><code class="xref py py-meth docutils literal"><span class="pre">get_ordering()</span></code></a>.</li>
<li>The new <a class="reference internal" href="../ref/class-based-views/mixins-single-object.html#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"><span class="pre">SingleObjectMixin.query_pk_and_slug</span></code></a>
attribute allows changing the behavior of
<a class="reference internal" href="../ref/class-based-views/mixins-single-object.html#django.views.generic.detail.SingleObjectMixin.get_object" title="django.views.generic.detail.SingleObjectMixin.get_object"><code class="xref py py-meth docutils literal"><span class="pre">get_object()</span></code></a>
so that it&#8217;ll perform its lookup using both the primary key and the slug.</li>
<li>The <a class="reference internal" href="../ref/class-based-views/mixins-editing.html#django.views.generic.edit.FormMixin.get_form" title="django.views.generic.edit.FormMixin.get_form"><code class="xref py py-meth docutils literal"><span class="pre">get_form()</span></code></a> method doesn&#8217;t
require a <code class="docutils literal"><span class="pre">form_class</span></code> to be provided anymore. If not provided <code class="docutils literal"><span class="pre">form_class</span></code>
defaults to <a class="reference internal" href="../ref/class-based-views/mixins-editing.html#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"><span class="pre">get_form_class()</span></code></a>.</li>
<li>Placeholders in <a class="reference internal" href="../ref/class-based-views/mixins-editing.html#django.views.generic.edit.ModelFormMixin.success_url" title="django.views.generic.edit.ModelFormMixin.success_url"><code class="xref py py-attr docutils literal"><span class="pre">ModelFormMixin.success_url</span></code></a> now support the Python
<code class="xref py py-meth docutils literal"><span class="pre">str.format()</span></code> syntax. The legacy <code class="docutils literal"><span class="pre">%(&lt;foo&gt;)s</span></code> syntax is still
supported but will be removed in Django 1.10.</li>
</ul>
</div>
<div class="section" id="s-internationalization">
<span id="internationalization"></span><h4>Internationalization<a class="headerlink" href="#internationalization" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/settings.html#std:setting-FORMAT_MODULE_PATH"><code class="xref std std-setting docutils literal"><span class="pre">FORMAT_MODULE_PATH</span></code></a> can now be a list of strings representing
module paths. This allows importing several format modules from different
reusable apps. It also allows overriding those custom formats in your main
Django project.</li>
</ul>
</div>
<div class="section" id="s-logging">
<span id="logging"></span><h4>Logging<a class="headerlink" href="#logging" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../topics/logging.html#django.utils.log.AdminEmailHandler" title="django.utils.log.AdminEmailHandler"><code class="xref py py-class docutils literal"><span class="pre">django.utils.log.AdminEmailHandler</span></code></a> class now has a
<a class="reference internal" href="../topics/logging.html#django.utils.log.AdminEmailHandler.send_mail" title="django.utils.log.AdminEmailHandler.send_mail"><code class="xref py py-meth docutils literal"><span class="pre">send_mail()</span></code></a> method to make it more
subclass friendly.</li>
</ul>
</div>
<div class="section" id="s-management-commands">
<span id="management-commands"></span><h4>Management Commands<a class="headerlink" href="#management-commands" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Database connections are now always closed after a management command called
from the command line has finished doing its job.</li>
<li>Commands from alternate package formats like eggs are now also discovered.</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-dumpdata"><code class="xref std std-djadmin docutils literal"><span class="pre">dumpdata</span></code></a> now has the option <a class="reference internal" href="../ref/django-admin.html#django-admin-option---output"><code class="xref std std-djadminopt docutils literal"><span class="pre">--output</span></code></a> which allows
specifying the file to which the serialized data is written.</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-makemessages"><code class="xref std std-djadmin docutils literal"><span class="pre">makemessages</span></code></a> and <a class="reference internal" href="../ref/django-admin.html#django-admin-compilemessages"><code class="xref std std-djadmin docutils literal"><span class="pre">compilemessages</span></code></a> now have the option
<a class="reference internal" href="../ref/django-admin.html#django-admin-option---exclude"><code class="xref std std-djadminopt docutils literal"><span class="pre">--exclude</span></code></a> which allows exclusion of specific locales from
processing.</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-compilemessages"><code class="xref std std-djadmin docutils literal"><span class="pre">compilemessages</span></code></a> now has a <code class="docutils literal"><span class="pre">--use-fuzzy</span></code> or <code class="docutils literal"><span class="pre">-f</span></code> option which
includes fuzzy translations into compiled files.</li>
<li>The <a class="reference internal" href="../ref/django-admin.html#django-admin-option---ignorenonexistent"><code class="xref std std-djadminopt docutils literal"><span class="pre">--ignorenonexistent</span></code></a> option of the <a class="reference internal" href="../ref/django-admin.html#django-admin-loaddata"><code class="xref std std-djadmin docutils literal"><span class="pre">loaddata</span></code></a>
management command now ignores data for models that no longer exist.</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-runserver"><code class="xref std std-djadmin docutils literal"><span class="pre">runserver</span></code></a> now uses daemon threads for faster reloading.</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-inspectdb"><code class="xref std std-djadmin docutils literal"><span class="pre">inspectdb</span></code></a> now outputs <code class="docutils literal"><span class="pre">Meta.unique_together</span></code>. It is also able to
introspect <a class="reference internal" href="../ref/models/fields.html#django.db.models.AutoField" title="django.db.models.AutoField"><code class="xref py py-class docutils literal"><span class="pre">AutoField</span></code></a> for MySQL and PostgreSQL
databases.</li>
<li>When calling management commands from code through <a class="reference internal" href="../ref/django-admin.html#call-command"><span class="std std-ref">call_command</span></a> and passing options, the option name can match the command
line option name (without the initial dashes) or the final option destination
variable name, but in either case, the resulting option received by the
command is now always the <code class="docutils literal"><span class="pre">dest</span></code> name specified in the command option
definition (as long as the command uses the new <code class="xref py py-mod docutils literal"><span class="pre">argparse</span></code> module).</li>
<li>The <a class="reference internal" href="../ref/django-admin.html#django-admin-dbshell"><code class="xref std std-djadmin docutils literal"><span class="pre">dbshell</span></code></a> command now supports MySQL&#8217;s optional SSL certificate
authority setting (<code class="docutils literal"><span class="pre">--ssl-ca</span></code>).</li>
<li>The <a class="reference internal" href="../ref/django-admin.html#django-admin-option---name"><code class="xref std std-djadminopt docutils literal"><span class="pre">--name</span></code></a> option for <a class="reference internal" href="../ref/django-admin.html#django-admin-makemigrations"><code class="xref std std-djadmin docutils literal"><span class="pre">makemigrations</span></code></a> allows you to
to give the migration(s) a custom name instead of a generated one.</li>
<li>The <a class="reference internal" href="../ref/django-admin.html#django-admin-loaddata"><code class="xref std std-djadmin docutils literal"><span class="pre">loaddata</span></code></a> command now prevents repeated fixture loading. If
<a class="reference internal" href="../ref/settings.html#std:setting-FIXTURE_DIRS"><code class="xref std std-setting docutils literal"><span class="pre">FIXTURE_DIRS</span></code></a> contains duplicates or a default fixture directory
path (<code class="docutils literal"><span class="pre">app_name/fixtures</span></code>), an exception is raised.</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-makemigrations"><code class="xref std std-djadmin docutils literal"><span class="pre">makemigrations</span></code></a> now supports an <a class="reference internal" href="../ref/django-admin.html#django-admin-option---exit"><code class="xref std std-djadminopt docutils literal"><span class="pre">--exit</span></code></a> option to
exit with an error code if no migrations are created.</li>
<li>The new <a class="reference internal" href="../ref/django-admin.html#django-admin-showmigrations"><code class="xref std std-djadmin docutils literal"><span class="pre">showmigrations</span></code></a> command allows listing all migrations and
their dependencies in a project.</li>
</ul>
</div>
<div class="section" id="s-middleware">
<span id="middleware"></span><h4>Middleware<a class="headerlink" href="#middleware" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../ref/middleware.html#django.middleware.common.CommonMiddleware.response_redirect_class" title="django.middleware.common.CommonMiddleware.response_redirect_class"><code class="xref py py-attr docutils literal"><span class="pre">CommonMiddleware.response_redirect_class</span></code></a>
attribute allows you to customize the redirects issued by the middleware.</li>
<li>A debug message will be logged to the <code class="docutils literal"><span class="pre">django.request</span></code> logger when a
middleware raises a <a class="reference internal" href="../ref/exceptions.html#django.core.exceptions.MiddlewareNotUsed" title="django.core.exceptions.MiddlewareNotUsed"><code class="xref py py-exc docutils literal"><span class="pre">MiddlewareNotUsed</span></code></a> exception
in <a class="reference internal" href="../ref/settings.html#std:setting-DEBUG"><code class="xref std std-setting docutils literal"><span class="pre">DEBUG</span></code></a> mode.</li>
</ul>
</div>
<div class="section" id="s-migrations">
<span id="migrations"></span><h4>Migrations<a class="headerlink" href="#migrations" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunSQL" title="django.db.migrations.operations.RunSQL"><code class="xref py py-class docutils literal"><span class="pre">RunSQL</span></code></a> operation can now handle
parameters passed to the SQL statements.</li>
<li>It is now possible to have migrations (most probably <a class="reference internal" href="../topics/migrations.html#data-migrations"><span class="std std-ref">data migrations</span></a>) for applications without models.</li>
<li>Migrations can now <a class="reference internal" href="../topics/migrations.html#using-managers-in-migrations"><span class="std std-ref">serialize model managers</span></a> as part of the model state.</li>
<li>A <a class="reference internal" href="../topics/migrations.html#migrations-removing-model-fields"><span class="std std-ref">generic mechanism to handle the deprecation of model fields</span></a> was added.</li>
<li>The <a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunPython.noop" title="django.db.migrations.operations.RunPython.noop"><code class="xref py py-meth docutils literal"><span class="pre">RunPython.noop()</span></code></a>
and <a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunSQL.noop" title="django.db.migrations.operations.RunSQL.noop"><code class="xref py py-attr docutils literal"><span class="pre">RunSQL.noop</span></code></a> class
method/attribute were added to ease in making <code class="docutils literal"><span class="pre">RunPython</span></code> and <code class="docutils literal"><span class="pre">RunSQL</span></code>
operations reversible.</li>
<li>The migration operations <a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunPython" title="django.db.migrations.operations.RunPython"><code class="xref py py-class docutils literal"><span class="pre">RunPython</span></code></a>
and <a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunSQL" title="django.db.migrations.operations.RunSQL"><code class="xref py py-class docutils literal"><span class="pre">RunSQL</span></code></a> now call the
<a class="reference internal" href="../topics/db/multi-db.html#allow_migrate" title="allow_migrate"><code class="xref py py-meth docutils literal"><span class="pre">allow_migrate()</span></code></a> method of database routers. The router can use the
newly introduced <code class="docutils literal"><span class="pre">app_label</span></code> and <code class="docutils literal"><span class="pre">hints</span></code> arguments to make a routing
decision. To take advantage of this feature you need to update the router to
the new <code class="docutils literal"><span class="pre">allow_migrate</span></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.</li>
</ul>
</div>
<div class="section" id="s-models">
<span id="models"></span><h4>Models<a class="headerlink" href="#models" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Django now logs at most 9000 queries in <code class="docutils literal"><span class="pre">connections.queries</span></code>, in order
to prevent excessive memory usage in long-running processes in debug mode.</li>
<li>There is now a model <code class="docutils literal"><span class="pre">Meta</span></code> option to define a
<a class="reference internal" href="../ref/models/options.html#django.db.models.Options.default_related_name" title="django.db.models.Options.default_related_name"><code class="xref py py-attr docutils literal"><span class="pre">default</span> <span class="pre">related</span> <span class="pre">name</span></code></a>
for all relational fields of a model.</li>
<li>Pickling models and querysets across different versions of Django isn&#8217;t
officially supported (it may work, but there&#8217;s no guarantee). An extra
variable that specifies the current Django version is now added to the
pickled state of models and querysets, and Django raises a <code class="docutils literal"><span class="pre">RuntimeWarning</span></code>
when these objects are unpickled in a different version than the one in
which they were pickled.</li>
<li>Added <a class="reference internal" href="../ref/models/instances.html#django.db.models.Model.from_db" title="django.db.models.Model.from_db"><code class="xref py py-meth docutils literal"><span class="pre">Model.from_db()</span></code></a> which
Django uses whenever objects are loaded using the ORM. The method allows
customizing model loading behavior.</li>
<li><code class="docutils literal"><span class="pre">extra(select={...})</span></code> now allows you to escape a literal <code class="docutils literal"><span class="pre">%s</span></code> sequence
using <code class="docutils literal"><span class="pre">%%s</span></code>.</li>
<li><a class="reference internal" href="../howto/custom-lookups.html"><span class="doc">Custom Lookups</span></a> can now be registered using
a decorator pattern.</li>
<li>The new <a class="reference internal" href="../ref/models/lookups.html#django.db.models.Transform.bilateral" title="django.db.models.Transform.bilateral"><code class="xref py py-attr docutils literal"><span class="pre">Transform.bilateral</span></code></a>
attribute allows creating bilateral transformations. These transformations
are applied to both <code class="docutils literal"><span class="pre">lhs</span></code> and <code class="docutils literal"><span class="pre">rhs</span></code> when used in a lookup expression,
providing opportunities for more sophisticated lookups.</li>
<li>SQL special characters (, %, _) are now escaped properly when a pattern
lookup (e.g. <code class="docutils literal"><span class="pre">contains</span></code>, <code class="docutils literal"><span class="pre">startswith</span></code>, etc.) is used with an <code class="docutils literal"><span class="pre">F()</span></code>
expression as the right-hand side. In those cases, the escaping is performed
by the database, which can lead to somewhat complex queries involving nested
<code class="docutils literal"><span class="pre">REPLACE</span></code> function calls.</li>
<li>You can now refresh model instances by using <a class="reference internal" href="../ref/models/instances.html#django.db.models.Model.refresh_from_db" title="django.db.models.Model.refresh_from_db"><code class="xref py py-meth docutils literal"><span class="pre">Model.refresh_from_db()</span></code></a>.</li>
<li>You can now get the set of deferred fields for a model using
<a class="reference internal" href="../ref/models/instances.html#django.db.models.Model.get_deferred_fields" title="django.db.models.Model.get_deferred_fields"><code class="xref py py-meth docutils literal"><span class="pre">Model.get_deferred_fields()</span></code></a>.</li>
<li>Model field <code class="docutils literal"><span class="pre">default</span></code>’s are now used when primary key field&#8217;s are set to
<code class="docutils literal"><span class="pre">None</span></code>.</li>
</ul>
</div>
<div class="section" id="s-signals">
<span id="signals"></span><h4>Signals<a class="headerlink" href="#signals" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Exceptions from the <code class="docutils literal"><span class="pre">(receiver,</span> <span class="pre">exception)</span></code> tuples returned by
<a class="reference internal" href="../topics/signals.html#django.dispatch.Signal.send_robust" title="django.dispatch.Signal.send_robust"><code class="xref py py-meth docutils literal"><span class="pre">Signal.send_robust()</span></code></a> now have
their traceback attached as a <code class="docutils literal"><span class="pre">__traceback__</span></code> attribute.</li>
<li>The <code class="docutils literal"><span class="pre">environ</span></code> argument, which contains the WSGI environment structure from
the request, was added to the <a class="reference internal" href="../ref/signals.html#django.core.signals.request_started" title="django.core.signals.request_started"><code class="xref py py-data docutils literal"><span class="pre">request_started</span></code></a>
signal.</li>
<li>You can now import the <a class="reference internal" href="../ref/signals.html#django.test.signals.setting_changed" title="django.test.signals.setting_changed"><code class="xref py py-func docutils literal"><span class="pre">setting_changed()</span></code></a> signal
from <code class="docutils literal"><span class="pre">django.core.signals</span></code> to avoid loading <code class="docutils literal"><span class="pre">django.test</span></code> in non-test
situations. Django no longer does so itself.</li>
</ul>
</div>
<div class="section" id="s-system-check-framework">
<span id="system-check-framework"></span><h4>System Check Framework<a class="headerlink" href="#system-check-framework" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../topics/checks.html#django.core.checks.register" title="django.core.checks.register"><code class="xref py py-attr docutils literal"><span class="pre">register</span></code></a> can now be used as a function.</li>
</ul>
</div>
<div class="section" id="s-templates">
<span id="templates"></span><h4>Templates<a class="headerlink" href="#templates" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-urlize"><code class="xref std std-tfilter docutils literal"><span class="pre">urlize</span></code></a> now supports domain-only links that include characters after
the top-level domain (e.g. <code class="docutils literal"><span class="pre">djangoproject.com/</span></code> and
<code class="docutils literal"><span class="pre">djangoproject.com/download/</span></code>).</li>
<li><a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-urlize"><code class="xref std std-tfilter docutils literal"><span class="pre">urlize</span></code></a> doesn&#8217;t treat exclamation marks at the end of a domain or
its query string as part of the URL (the URL in e.g. <code class="docutils literal"><span class="pre">'djangoproject.com!</span></code>
is <code class="docutils literal"><span class="pre">djangoproject.com</span></code>)</li>
<li>Added a <a class="reference internal" href="../ref/templates/api.html#django.template.loaders.locmem.Loader" title="django.template.loaders.locmem.Loader"><code class="xref py py-class docutils literal"><span class="pre">locmem.Loader</span></code></a>
class that loads Django templates from a Python dictionary.</li>
<li>The <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-now"><code class="xref std std-ttag docutils literal"><span class="pre">now</span></code></a> tag can now store its output in a context variable with the
usual syntax: <code class="docutils literal"><span class="pre">{%</span> <span class="pre">now</span> <span class="pre">'j</span> <span class="pre">n</span> <span class="pre">Y'</span> <span class="pre">as</span> <span class="pre">varname</span> <span class="pre">%}</span></code>.</li>
</ul>
</div>
<div class="section" id="s-requests-and-responses">
<span id="requests-and-responses"></span><h4>Requests and Responses<a class="headerlink" href="#requests-and-responses" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">WSGIRequest</span></code> now respects paths starting with <code class="docutils literal"><span class="pre">//</span></code>.</li>
<li>The <a class="reference internal" href="../ref/request-response.html#django.http.HttpRequest.build_absolute_uri" title="django.http.HttpRequest.build_absolute_uri"><code class="xref py py-meth docutils literal"><span class="pre">HttpRequest.build_absolute_uri()</span></code></a> method now handles paths
starting with <code class="docutils literal"><span class="pre">//</span></code> correctly.</li>
<li>If <a class="reference internal" href="../ref/settings.html#std:setting-DEBUG"><code class="xref std std-setting docutils literal"><span class="pre">DEBUG</span></code></a> is <code class="docutils literal"><span class="pre">True</span></code> and a request raises a
<a class="reference internal" href="../ref/exceptions.html#django.core.exceptions.SuspiciousOperation" title="django.core.exceptions.SuspiciousOperation"><code class="xref py py-exc docutils literal"><span class="pre">SuspiciousOperation</span></code></a>, the response will be
rendered with a detailed error page.</li>
<li>The <code class="docutils literal"><span class="pre">query_string</span></code> argument of <a class="reference internal" href="../ref/request-response.html#django.http.QueryDict" title="django.http.QueryDict"><code class="xref py py-class docutils literal"><span class="pre">QueryDict</span></code></a> is now
optional, defaulting to <code class="docutils literal"><span class="pre">None</span></code>, so a blank <code class="docutils literal"><span class="pre">QueryDict</span></code> can now be
instantiated with <code class="docutils literal"><span class="pre">QueryDict()</span></code> instead of <code class="docutils literal"><span class="pre">QueryDict(None)</span></code> or
<code class="docutils literal"><span class="pre">QueryDict('')</span></code>.</li>
<li>The <code class="docutils literal"><span class="pre">GET</span></code> and <code class="docutils literal"><span class="pre">POST</span></code> attributes of an <a class="reference internal" href="../ref/request-response.html#django.http.HttpRequest" title="django.http.HttpRequest"><code class="xref py py-class docutils literal"><span class="pre">HttpRequest</span></code></a>
object are now <a class="reference internal" href="../ref/request-response.html#django.http.QueryDict" title="django.http.QueryDict"><code class="xref py py-class docutils literal"><span class="pre">QueryDict</span></code></a>s rather than dictionaries,
and the <code class="docutils literal"><span class="pre">FILES</span></code> attribute is now a <code class="docutils literal"><span class="pre">MultiValueDict</span></code>.
This brings this class into line with the documentation and with
<code class="docutils literal"><span class="pre">WSGIRequest</span></code>.</li>
<li>The <a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse.charset" title="django.http.HttpResponse.charset"><code class="xref py py-attr docutils literal"><span class="pre">HttpResponse.charset</span></code></a> attribute
was added.</li>
<li><code class="docutils literal"><span class="pre">WSGIRequestHandler</span></code> now follows RFC in converting URI to IRI, using
<code class="docutils literal"><span class="pre">uri_to_iri()</span></code>.</li>
<li>The <a class="reference internal" href="../ref/request-response.html#django.http.HttpRequest.get_full_path" title="django.http.HttpRequest.get_full_path"><code class="xref py py-meth docutils literal"><span class="pre">HttpRequest.get_full_path()</span></code></a> method now escapes unsafe characters
from the path portion of a Uniform Resource Identifier (URI) properly.</li>
<li><a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse" title="django.http.HttpResponse"><code class="xref py py-class docutils literal"><span class="pre">HttpResponse</span></code></a> now implements a few additional methods
like <a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse.getvalue" title="django.http.HttpResponse.getvalue"><code class="xref py py-meth docutils literal"><span class="pre">getvalue()</span></code></a> so that instances can be used
as stream objects.</li>
<li>The new <a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse.setdefault" title="django.http.HttpResponse.setdefault"><code class="xref py py-meth docutils literal"><span class="pre">HttpResponse.setdefault()</span></code></a> method allows setting a header unless
it has already been set.</li>
<li>You can use the new <a class="reference internal" href="../ref/request-response.html#django.http.FileResponse" title="django.http.FileResponse"><code class="xref py py-class docutils literal"><span class="pre">FileResponse</span></code></a> to stream files.</li>
<li>The <a class="reference internal" href="../topics/http/decorators.html#django.views.decorators.http.condition" title="django.views.decorators.http.condition"><code class="xref py py-func docutils literal"><span class="pre">condition()</span></code></a> decorator for
conditional view processing now supports the <code class="docutils literal"><span class="pre">If-unmodified-since</span></code> header.</li>
</ul>
</div>
<div class="section" id="s-tests">
<span id="tests"></span><h4>Tests<a class="headerlink" href="#tests" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../topics/testing/advanced.html#django.test.RequestFactory" title="django.test.RequestFactory"><code class="xref py py-class docutils literal"><span class="pre">RequestFactory.trace()</span></code></a>
and <a class="reference internal" href="../topics/testing/tools.html#django.test.Client.trace" title="django.test.Client.trace"><code class="xref py py-class docutils literal"><span class="pre">Client.trace()</span></code></a> methods were
implemented, allowing you to create <code class="docutils literal"><span class="pre">TRACE</span></code> requests in your tests.</li>
<li>The <code class="docutils literal"><span class="pre">count</span></code> argument was added to
<a class="reference internal" href="../topics/testing/tools.html#django.test.SimpleTestCase.assertTemplateUsed" title="django.test.SimpleTestCase.assertTemplateUsed"><code class="xref py py-meth docutils literal"><span class="pre">assertTemplateUsed()</span></code></a>. This allows you to
assert that a template was rendered a specific number of times.</li>
<li>The new <a class="reference internal" href="../topics/testing/tools.html#django.test.SimpleTestCase.assertJSONNotEqual" title="django.test.SimpleTestCase.assertJSONNotEqual"><code class="xref py py-meth docutils literal"><span class="pre">assertJSONNotEqual()</span></code></a> assertion
allows you to test that two JSON fragments are not equal.</li>
<li>Added options to the <a class="reference internal" href="../ref/django-admin.html#django-admin-test"><code class="xref std std-djadmin docutils literal"><span class="pre">test</span></code></a> command to preserve the test database
(<a class="reference internal" href="../ref/django-admin.html#django-admin-option---keepdb"><code class="xref std std-djadminopt docutils literal"><span class="pre">--keepdb</span></code></a>), to run the test cases in reverse order
(<a class="reference internal" href="../ref/django-admin.html#django-admin-option---reverse"><code class="xref std std-djadminopt docutils literal"><span class="pre">--reverse</span></code></a>), and to enable SQL logging for failing tests
(<a class="reference internal" href="../ref/django-admin.html#django-admin-option---debug-sql"><code class="xref std std-djadminopt docutils literal"><span class="pre">--debug-sql</span></code></a>).</li>
<li>Added the <a class="reference internal" href="../topics/testing/tools.html#django.test.Response.resolver_match" title="django.test.Response.resolver_match"><code class="xref py py-attr docutils literal"><span class="pre">resolver_match</span></code></a> attribute to test
client responses.</li>
<li>Added several settings that allow customization of test tablespace parameters
for Oracle: <a class="reference internal" href="../ref/settings.html#std:setting-DATAFILE"><code class="xref std std-setting docutils literal"><span class="pre">DATAFILE</span></code></a>, <a class="reference internal" href="../ref/settings.html#std:setting-DATAFILE_TMP"><code class="xref std std-setting docutils literal"><span class="pre">DATAFILE_TMP</span></code></a>,
<a class="reference internal" href="../ref/settings.html#std:setting-DATAFILE_MAXSIZE"><code class="xref std std-setting docutils literal"><span class="pre">DATAFILE_MAXSIZE</span></code></a> and <a class="reference internal" href="../ref/settings.html#std:setting-DATAFILE_TMP_MAXSIZE"><code class="xref std std-setting docutils literal"><span class="pre">DATAFILE_TMP_MAXSIZE</span></code></a>.</li>
<li>The <a class="reference internal" href="../topics/testing/tools.html#django.test.override_settings" title="django.test.override_settings"><code class="xref py py-func docutils literal"><span class="pre">override_settings()</span></code></a> decorator can now affect the
master router in <a class="reference internal" href="../ref/settings.html#std:setting-DATABASE_ROUTERS"><code class="xref std std-setting docutils literal"><span class="pre">DATABASE_ROUTERS</span></code></a>.</li>
<li>Added test client support for file uploads with file-like objects.</li>
<li>A shared cache is now used when testing with a SQLite in-memory database when
using Python 3.4+ and SQLite 3.7.13+. This allows sharing the database
between threads.</li>
</ul>
</div>
<div class="section" id="s-validators">
<span id="validators"></span><h4>Validators<a class="headerlink" href="#validators" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/validators.html#django.core.validators.URLValidator" title="django.core.validators.URLValidator"><code class="xref py py-class docutils literal"><span class="pre">URLValidator</span></code></a> now supports IPv6 addresses,
unicode domains, and URLs containing authentication data.</li>
</ul>
</div>
</div>
</div>
<div class="section" id="s-backwards-incompatible-changes-in-1-8">
<span id="s-backwards-incompatible-1-8"></span><span id="backwards-incompatible-changes-in-1-8"></span><span id="backwards-incompatible-1-8"></span><h2>Backwards incompatible changes in 1.8<a class="headerlink" href="#backwards-incompatible-changes-in-1-8" title="Permalink to this headline">¶</a></h2>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">In addition to the changes outlined in this section, be sure to review the
<a class="reference internal" href="../internals/deprecation.html#deprecation-removed-in-1-8"><span class="std std-ref">deprecation plan</span></a> for any features that
have been removed. If you haven&#8217;t updated your code within the
deprecation timeline for a given feature, its removal may appear as a
backwards incompatible change.</p>
</div>
<div class="section" id="s-related-object-operations-are-run-in-a-transaction">
<span id="related-object-operations-are-run-in-a-transaction"></span><h3>Related object operations are run in a transaction<a class="headerlink" href="#related-object-operations-are-run-in-a-transaction" title="Permalink to this headline">¶</a></h3>
<p>Some operations on related objects such as
<a class="reference internal" href="../ref/models/relations.html#django.db.models.fields.related.RelatedManager.add" title="django.db.models.fields.related.RelatedManager.add"><code class="xref py py-meth docutils literal"><span class="pre">add()</span></code></a> or
<a class="reference internal" href="../ref/models/relations.html#direct-assignment"><span class="std std-ref">direct assignment</span></a> ran multiple data modifying
queries without wrapping them in transactions. To reduce the risk of data
corruption, all data modifying methods that affect multiple related objects
(i.e. <code class="docutils literal"><span class="pre">add()</span></code>, <code class="docutils literal"><span class="pre">remove()</span></code>, <code class="docutils literal"><span class="pre">clear()</span></code>, and <a class="reference internal" href="../ref/models/relations.html#direct-assignment"><span class="std std-ref">direct assignment</span></a>) now perform their data modifying queries from within a
transaction, provided your database supports transactions.</p>
<p>This has one backwards incompatible side effect, signal handlers triggered from
these methods are now executed within the method&#8217;s transaction and any
exception in a signal handler will prevent the whole operation.</p>
</div>
<div class="section" id="s-assigning-unsaved-objects-to-relations-raises-an-error">
<span id="s-unsaved-model-instance-check-18"></span><span id="assigning-unsaved-objects-to-relations-raises-an-error"></span><span id="unsaved-model-instance-check-18"></span><h3>Assigning unsaved objects to relations raises an error<a class="headerlink" href="#assigning-unsaved-objects-to-relations-raises-an-error" title="Permalink to this headline">¶</a></h3>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>To more easily allow in-memory usage of models, this change was reverted in
Django 1.8.4 and replaced with a check during <code class="docutils literal"><span class="pre">model.save()</span></code>. For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">book</span> <span class="o">=</span> <span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;Django&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">book</span><span class="o">.</span><span class="n">author</span> <span class="o">=</span> <span class="n">Author</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;John&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">book</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">save() prohibited to prevent data loss due to unsaved related object &#39;author&#39;.</span>
</pre></div>
</div>
<p class="last">A similar check on assignment to reverse one-to-one relations was removed
in Django 1.8.5.</p>
</div>
<p>Assigning unsaved objects to a <a class="reference internal" href="../ref/models/fields.html#django.db.models.ForeignKey" title="django.db.models.ForeignKey"><code class="xref py py-class docutils literal"><span class="pre">ForeignKey</span></code></a>,
<a class="reference internal" href="../ref/contrib/contenttypes.html#django.contrib.contenttypes.fields.GenericForeignKey" title="django.contrib.contenttypes.fields.GenericForeignKey"><code class="xref py py-class docutils literal"><span class="pre">GenericForeignKey</span></code></a>, and
<a class="reference internal" href="../ref/models/fields.html#django.db.models.OneToOneField" title="django.db.models.OneToOneField"><code class="xref py py-class docutils literal"><span class="pre">OneToOneField</span></code></a> now raises a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code>.</p>
<p>Previously, the assignment of an unsaved object would be silently ignored.
For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">book</span> <span class="o">=</span> <span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;Django&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">book</span><span class="o">.</span><span class="n">author</span> <span class="o">=</span> <span class="n">Author</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;John&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">book</span><span class="o">.</span><span class="n">author</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">book</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;Django&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">book</span><span class="o">.</span><span class="n">author</span>
<span class="go">&gt;&gt;&gt;</span>
</pre></div>
</div>
<p>Now, an error will be raised to prevent data loss:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">book</span><span class="o">.</span><span class="n">author</span> <span class="o">=</span> <span class="n">Author</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;john&quot;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">Cannot assign &quot;&lt;Author: John&gt;&quot;: &quot;Author&quot; instance isn&#39;t saved in the database.</span>
</pre></div>
</div>
<p>If you require allowing the assignment of unsaved instances (the old behavior)
and aren&#8217;t concerned about the data loss possibility (e.g. you never save the
objects to the database), you can disable this check by using the
<code class="docutils literal"><span class="pre">ForeignKey.allow_unsaved_instance_assignment</span></code> attribute. (This attribute was
removed in 1.8.4 as it&#8217;s no longer relevant.)</p>
</div>
<div class="section" id="s-management-commands-that-only-accept-positional-arguments">
<span id="management-commands-that-only-accept-positional-arguments"></span><h3>Management commands that only accept positional arguments<a class="headerlink" href="#management-commands-that-only-accept-positional-arguments" title="Permalink to this headline">¶</a></h3>
<p>If you have written a custom management command that only accepts positional
arguments and you didn&#8217;t specify the
<a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.BaseCommand.args" title="django.core.management.BaseCommand.args"><code class="xref py py-attr docutils literal"><span class="pre">args</span></code></a> command variable, you might
get an error like <code class="docutils literal"><span class="pre">Error:</span> <span class="pre">unrecognized</span> <span class="pre">arguments:</span> <span class="pre">...</span></code>, as variable parsing
is now based on <code class="xref py py-mod docutils literal"><span class="pre">argparse</span></code> which doesn&#8217;t implicitly accept positional
arguments. You can make your command backwards compatible by simply setting the
<a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.BaseCommand.args" title="django.core.management.BaseCommand.args"><code class="xref py py-attr docutils literal"><span class="pre">args</span></code></a> class variable. However, if
you don&#8217;t have to keep compatibility with older Django versions, it&#8217;s better to
implement the new <a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.BaseCommand.add_arguments" title="django.core.management.BaseCommand.add_arguments"><code class="xref py py-meth docutils literal"><span class="pre">add_arguments()</span></code></a>
method as described in <a class="reference internal" href="../howto/custom-management-commands.html"><span class="doc">Writing custom django-admin commands</span></a>.</p>
</div>
<div class="section" id="s-custom-test-management-command-arguments-through-test-runner">
<span id="custom-test-management-command-arguments-through-test-runner"></span><h3>Custom test management command arguments through test runner<a class="headerlink" href="#custom-test-management-command-arguments-through-test-runner" title="Permalink to this headline">¶</a></h3>
<p>The method to add custom arguments to the <cite>test</cite> management command through the
test runner has changed. Previously, you could provide an <cite>option_list</cite> class
variable on the test runner to add more arguments (à la <code class="xref py py-mod docutils literal"><span class="pre">optparse</span></code>).
Now to implement the same behavior, you have to create an
<code class="docutils literal"><span class="pre">add_arguments(cls,</span> <span class="pre">parser)</span></code> class method on the test runner and call
<code class="docutils literal"><span class="pre">parser.add_argument</span></code> to add any custom arguments, as parser is now an
<code class="xref py py-class docutils literal"><span class="pre">argparse.ArgumentParser</span></code> instance.</p>
</div>
<div class="section" id="s-model-check-ensures-auto-generated-column-names-are-within-limits-specified-by-database">
<span id="model-check-ensures-auto-generated-column-names-are-within-limits-specified-by-database"></span><h3>Model check ensures auto-generated column names are within limits specified by database<a class="headerlink" href="#model-check-ensures-auto-generated-column-names-are-within-limits-specified-by-database" title="Permalink to this headline">¶</a></h3>
<p>A field name that&#8217;s longer than the column name length supported by a database
can create problems. For example, with MySQL you&#8217;ll get an exception trying to
create the column, and with PostgreSQL the column name is truncated by the
database (you may see a warning in the PostgreSQL logs).</p>
<p>A model check has been introduced to better alert users to this scenario before
the actual creation of database tables.</p>
<p>If you have an existing model where this check seems to be a false positive,
for example on PostgreSQL where the name was already being truncated, simply
use <a class="reference internal" href="../ref/models/fields.html#django.db.models.Field.db_column" title="django.db.models.Field.db_column"><code class="xref py py-attr docutils literal"><span class="pre">db_column</span></code></a> to specify the name that&#8217;s being
used.</p>
<p>The check also applies to the columns generated in an implicit
<code class="docutils literal"><span class="pre">ManyToManyField.through</span></code> model. If you run into an issue there, use
<a class="reference internal" href="../ref/models/fields.html#django.db.models.ManyToManyField.through" title="django.db.models.ManyToManyField.through"><code class="xref py py-attr docutils literal"><span class="pre">through</span></code></a> to create an explicit model
and then specify <a class="reference internal" href="../ref/models/fields.html#django.db.models.Field.db_column" title="django.db.models.Field.db_column"><code class="xref py py-attr docutils literal"><span class="pre">db_column</span></code></a> on its column(s)
as needed.</p>
</div>
<div class="section" id="s-query-relation-lookups-now-check-object-types">
<span id="query-relation-lookups-now-check-object-types"></span><h3>Query relation lookups now check object types<a class="headerlink" href="#query-relation-lookups-now-check-object-types" title="Permalink to this headline">¶</a></h3>
<p>Querying for model lookups now checks if the object passed is of correct type
and raises a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> if not. Previously, Django didn&#8217;t care if the
object was of correct type; it just used the object&#8217;s related field attribute
(e.g. <code class="docutils literal"><span class="pre">id</span></code>) for the lookup. Now, an error is raised to prevent incorrect
lookups:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">book</span> <span class="o">=</span> <span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;Django&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">book</span> <span class="o">=</span> <span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">author</span><span class="o">=</span><span class="n">book</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">ValueError</span>: <span class="n">Cannot query &quot;&lt;Book: Django&gt;&quot;: Must be &quot;Author&quot; instance.</span>
</pre></div>
</div>
</div>
<div class="section" id="s-select-related-now-checks-given-fields">
<span id="select-related-now-checks-given-fields"></span><h3><code class="docutils literal"><span class="pre">select_related()</span></code> now checks given fields<a class="headerlink" href="#select-related-now-checks-given-fields" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal"><span class="pre">select_related()</span></code> now validates that the given fields actually exist.
Previously, nonexistent fields were silently ignored. Now, an error is raised:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">book</span> <span class="o">=</span> <span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">select_related</span><span class="p">(</span><span class="s1">&#39;nonexistent_field&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">FieldError</span>: <span class="n">Invalid field name(s) given in select_related: &#39;nonexistent_field&#39;</span>
</pre></div>
</div>
<p>The validation also makes sure that the given field is relational:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">book</span> <span class="o">=</span> <span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">select_related</span><span class="p">(</span><span class="s1">&#39;name&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">FieldError</span>: <span class="n">Non-relational field given in select_related: &#39;name&#39;</span>
</pre></div>
</div>
</div>
<div class="section" id="s-default-emailfield-max-length-increased-to-254">
<span id="default-emailfield-max-length-increased-to-254"></span><h3>Default <code class="docutils literal"><span class="pre">EmailField.max_length</span></code> increased to 254<a class="headerlink" href="#default-emailfield-max-length-increased-to-254" title="Permalink to this headline">¶</a></h3>
<p>The old default 75 character <code class="docutils literal"><span class="pre">max_length</span></code> was not capable of storing all
possible RFC3696/5321-compliant email addresses. In order to store all
possible valid email addresses, the <code class="docutils literal"><span class="pre">max_length</span></code> has been increased to 254
characters. You will need to generate and apply database migrations for your
affected models (or add <code class="docutils literal"><span class="pre">max_length=75</span></code> if you wish to keep the length on
your current fields). A migration for
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.User.email" title="django.contrib.auth.models.User.email"><code class="xref py py-attr docutils literal"><span class="pre">django.contrib.auth.models.User.email</span></code></a> is included.</p>
</div>
<div class="section" id="s-support-for-postgresql-versions-older-than-9-0">
<span id="support-for-postgresql-versions-older-than-9-0"></span><h3>Support for PostgreSQL versions older than 9.0<a class="headerlink" href="#support-for-postgresql-versions-older-than-9-0" title="Permalink to this headline">¶</a></h3>
<p>The end of upstream support periods was reached in July 2014 for PostgreSQL 8.4.
As a consequence, Django 1.8 sets 9.0 as the minimum PostgreSQL version it
officially supports.</p>
<p>This also includes dropping support for PostGIS 1.3 and 1.4 as these versions
are not supported on versions of PostgreSQL later than 8.4.</p>
<p>Django also now requires the use of Psycopg2 version 2.4.5 or higher (or 2.5+
if you want to use <a class="reference internal" href="../ref/contrib/postgres/index.html#module-django.contrib.postgres" title="django.contrib.postgres: PostgreSQL-specific fields and features"><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.postgres</span></code></a>).</p>
</div>
<div class="section" id="s-support-for-mysql-versions-older-than-5-5">
<span id="support-for-mysql-versions-older-than-5-5"></span><h3>Support for MySQL versions older than 5.5<a class="headerlink" href="#support-for-mysql-versions-older-than-5-5" title="Permalink to this headline">¶</a></h3>
<p>The end of upstream support periods was reached in January 2012 for MySQL 5.0
and December 2013 for MySQL 5.1. As a consequence, Django 1.8 sets 5.5 as the
minimum MySQL version it officially supports.</p>
</div>
<div class="section" id="s-support-for-oracle-versions-older-than-11-1">
<span id="support-for-oracle-versions-older-than-11-1"></span><h3>Support for Oracle versions older than 11.1<a class="headerlink" href="#support-for-oracle-versions-older-than-11-1" title="Permalink to this headline">¶</a></h3>
<p>The end of upstream support periods was reached in July 2010 for Oracle 9.2,
January 2012 for Oracle 10.1, and July 2013 for Oracle 10.2. As a consequence,
Django 1.8 sets 11.1 as the minimum Oracle version it officially supports.</p>
</div>
<div class="section" id="s-specific-privileges-used-instead-of-roles-for-tests-on-oracle">
<span id="specific-privileges-used-instead-of-roles-for-tests-on-oracle"></span><h3>Specific privileges used instead of roles for tests on Oracle<a class="headerlink" href="#specific-privileges-used-instead-of-roles-for-tests-on-oracle" title="Permalink to this headline">¶</a></h3>
<p>Earlier versions of Django granted the CONNECT and RESOURCE roles to the test
user on Oracle. These roles have been deprecated, so Django 1.8 uses the
specific underlying privileges instead. This changes the privileges required
of the main user for running tests (unless the project is configured to avoid
creating a test user). The exact privileges required now are detailed in
<a class="reference internal" href="../ref/databases.html#oracle-notes"><span class="std std-ref">Oracle notes</span></a>.</p>
</div>
<div class="section" id="s-abstractuser-last-login-allows-null-values">
<span id="abstractuser-last-login-allows-null-values"></span><h3><code class="docutils literal"><span class="pre">AbstractUser.last_login</span></code> allows null values<a class="headerlink" href="#abstractuser-last-login-allows-null-values" title="Permalink to this headline">¶</a></h3>
<p>The <a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.User.last_login" title="django.contrib.auth.models.User.last_login"><code class="xref py py-attr docutils literal"><span class="pre">AbstractUser.last_login</span></code></a>
field now allows null values. Previously, it defaulted to the time when the user
was created which was misleading if the user never logged in. If you are using
the default user (<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.User" title="django.contrib.auth.models.User"><code class="xref py py-class docutils literal"><span class="pre">django.contrib.auth.models.User</span></code></a>), run the database
migration included in <code class="docutils literal"><span class="pre">contrib.auth</span></code>.</p>
<p>If you are using a custom user model that inherits from <code class="docutils literal"><span class="pre">AbstractUser</span></code>,
you&#8217;ll need to run <a class="reference internal" href="../ref/django-admin.html#django-admin-makemigrations"><code class="xref std std-djadmin docutils literal"><span class="pre">makemigrations</span></code></a> and generate a migration for your
app that contains that model. Also, if wish to set <code class="docutils literal"><span class="pre">last_login</span></code> to <code class="docutils literal"><span class="pre">NULL</span></code>
for users who haven&#8217;t logged in, you can run this query:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db</span> <span class="k">import</span> <span class="n">models</span>
<span class="kn">from</span> <span class="nn">django.contrib.auth</span> <span class="k">import</span> <span class="n">get_user_model</span>
<span class="kn">from</span> <span class="nn">django.contrib.auth.models</span> <span class="k">import</span> <span class="n">AbstractBaseUser</span>

<span class="n">UserModel</span> <span class="o">=</span> <span class="n">get_user_model</span><span class="p">()</span>
<span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">UserModel</span><span class="p">,</span> <span class="n">AbstractBaseUser</span><span class="p">):</span>
    <span class="n">UserModel</span><span class="o">.</span><span class="n">_default_manager</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span>
        <span class="n">last_login</span><span class="o">=</span><span class="n">models</span><span class="o">.</span><span class="n">F</span><span class="p">(</span><span class="s1">&#39;date_joined&#39;</span><span class="p">)</span>
    <span class="p">)</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">last_login</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="s-id1">
<span id="id1"></span><h3><a class="reference internal" href="../ref/contrib/gis/index.html#module-django.contrib.gis" title="django.contrib.gis: Geographic Information System (GIS) extensions for Django"><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.gis</span></code></a><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>Support for GEOS 3.1 and GDAL 1.6 has been dropped.</li>
<li>Support for SpatiaLite &lt; 2.4 has been dropped.</li>
<li>GIS-specific lookups have been refactored to use the
<a class="reference internal" href="../ref/models/lookups.html#django.db.models.Lookup" title="django.db.models.Lookup"><code class="xref py py-class docutils literal"><span class="pre">django.db.models.Lookup</span></code></a> API.</li>
<li>The default <code class="docutils literal"><span class="pre">str</span></code> representation of
<a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.GEOSGeometry" title="django.contrib.gis.geos.GEOSGeometry"><code class="xref py py-class docutils literal"><span class="pre">GEOSGeometry</span></code></a> objects has been changed from
WKT to EWKT format (including the SRID). As this representation is used in
the serialization framework, that means that <code class="docutils literal"><span class="pre">dumpdata</span></code> output will now
contain the SRID value of geometry objects.</li>
</ul>
</div>
<div class="section" id="s-priority-of-context-processors-for-templateresponse-brought-in-line-with-render">
<span id="priority-of-context-processors-for-templateresponse-brought-in-line-with-render"></span><h3>Priority of context processors for <code class="docutils literal"><span class="pre">TemplateResponse</span></code> brought in line with <code class="docutils literal"><span class="pre">render</span></code><a class="headerlink" href="#priority-of-context-processors-for-templateresponse-brought-in-line-with-render" title="Permalink to this headline">¶</a></h3>
<p>The <a class="reference internal" href="../ref/template-response.html#django.template.response.TemplateResponse" title="django.template.response.TemplateResponse"><code class="xref py py-class docutils literal"><span class="pre">TemplateResponse</span></code></a> constructor is designed to be a
drop-in replacement for the <a class="reference internal" href="../topics/http/shortcuts.html#django.shortcuts.render" title="django.shortcuts.render"><code class="xref py py-func docutils literal"><span class="pre">render()</span></code></a> function. However,
it had a slight incompatibility, in that for <code class="docutils literal"><span class="pre">TemplateResponse</span></code>, context data
from the passed in context dictionary could be shadowed by context data returned
from context processors, whereas for <code class="docutils literal"><span class="pre">render</span></code> it was the other way
around. This was a bug, and the behavior of <code class="docutils literal"><span class="pre">render</span></code> is more appropriate,
since it allows the globally defined context processors to be overridden locally
in the view. If you were relying on the fact context data in a
<code class="docutils literal"><span class="pre">TemplateResponse</span></code> could be overridden using a context processor, you will
need to change your code.</p>
</div>
<div class="section" id="s-overriding-setupclass-teardownclass-in-test-cases">
<span id="overriding-setupclass-teardownclass-in-test-cases"></span><h3>Overriding <code class="docutils literal"><span class="pre">setUpClass</span></code> / <code class="docutils literal"><span class="pre">tearDownClass</span></code> in test cases<a class="headerlink" href="#overriding-setupclass-teardownclass-in-test-cases" title="Permalink to this headline">¶</a></h3>
<p>The decorators <a class="reference internal" href="../topics/testing/tools.html#django.test.override_settings" title="django.test.override_settings"><code class="xref py py-func docutils literal"><span class="pre">override_settings()</span></code></a> and
<a class="reference internal" href="../topics/testing/tools.html#django.test.modify_settings" title="django.test.modify_settings"><code class="xref py py-func docutils literal"><span class="pre">modify_settings()</span></code></a> now act at the class level when used as
class decorators. As a consequence, when overriding <code class="docutils literal"><span class="pre">setUpClass()</span></code> or
<code class="docutils literal"><span class="pre">tearDownClass()</span></code>, the <code class="docutils literal"><span class="pre">super</span></code> implementation should always be called.</p>
</div>
<div class="section" id="s-removal-of-django-contrib-formtools">
<span id="removal-of-django-contrib-formtools"></span><h3>Removal of <code class="docutils literal"><span class="pre">django.contrib.formtools</span></code><a class="headerlink" href="#removal-of-django-contrib-formtools" title="Permalink to this headline">¶</a></h3>
<p>The formtools contrib app has been moved into a separate package.
<code class="docutils literal"><span class="pre">django.contrib.formtools</span></code> itself has been removed. The docs provide
<a class="reference internal" href="../ref/contrib/formtools/index.html#formtools-how-to-migrate"><span class="std std-ref">migration instructions</span></a>.</p>
<p>The new package is available <a class="reference external" href="https://github.com/django/django-formtools/">on Github</a> and on PyPI.</p>
</div>
<div class="section" id="s-database-connection-reloading-between-tests">
<span id="database-connection-reloading-between-tests"></span><h3>Database connection reloading between tests<a class="headerlink" href="#database-connection-reloading-between-tests" title="Permalink to this headline">¶</a></h3>
<p>Django previously closed database connections between each test within a
<code class="docutils literal"><span class="pre">TestCase</span></code>. This is no longer the case as Django now wraps the whole
<code class="docutils literal"><span class="pre">TestCase</span></code> within a transaction. If some of your tests relied on the old
behavior, you should have them inherit from <code class="docutils literal"><span class="pre">TransactionTestCase</span></code> instead.</p>
</div>
<div class="section" id="s-cleanup-of-the-django-template-namespace">
<span id="cleanup-of-the-django-template-namespace"></span><h3>Cleanup of the <code class="docutils literal"><span class="pre">django.template</span></code> namespace<a class="headerlink" href="#cleanup-of-the-django-template-namespace" title="Permalink to this headline">¶</a></h3>
<p>If you&#8217;ve been relying on private APIs exposed in the <code class="docutils literal"><span class="pre">django.template</span></code>
module, you may have to import them from <code class="docutils literal"><span class="pre">django.template.base</span></code> instead.</p>
<p>Also private APIs <code class="docutils literal"><span class="pre">django.template.base.compile_string()</span></code>,
<code class="docutils literal"><span class="pre">django.template.loader.find_template()</span></code>, and
<code class="docutils literal"><span class="pre">django.template.loader.get_template_from_string()</span></code> were removed.</p>
</div>
<div class="section" id="s-model-attribute-on-private-model-relations">
<span id="model-attribute-on-private-model-relations"></span><h3><code class="docutils literal"><span class="pre">model</span></code> attribute on private model relations<a class="headerlink" href="#model-attribute-on-private-model-relations" title="Permalink to this headline">¶</a></h3>
<p>In earlier versions of Django, on a model with a reverse foreign key
relationship (for example), <code class="docutils literal"><span class="pre">model._meta.get_all_related_objects()</span></code> returned
the relationship as a <code class="docutils literal"><span class="pre">django.db.models.related.RelatedObject</span></code> with the
<code class="docutils literal"><span class="pre">model</span></code> attribute set to the source of the relationship. Now, this method
returns the relationship as <code class="docutils literal"><span class="pre">django.db.models.fields.related.ManyToOneRel</span></code>
(private API <code class="docutils literal"><span class="pre">RelatedObject</span></code> has been removed), and the <code class="docutils literal"><span class="pre">model</span></code> attribute
is set to the target of the relationship instead of the source. The source
model is accessible on the <code class="docutils literal"><span class="pre">related_model</span></code> attribute instead.</p>
<p>Consider this example from the tutorial in Django 1.8:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Poll</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">pk</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">_meta</span><span class="o">.</span><span class="n">get_all_related_objects</span><span class="p">()</span>
<span class="go">[&lt;ManyToOneRel: polls.choice&gt;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">_meta</span><span class="o">.</span><span class="n">get_all_related_objects</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">model</span>
<span class="go">&lt;class &#39;polls.models.Poll&#39;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">_meta</span><span class="o">.</span><span class="n">get_all_related_objects</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">related_model</span>
<span class="go">&lt;class &#39;polls.models.Choice&#39;&gt;</span>
</pre></div>
</div>
<p>and compare it to the behavior on older versions:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">_meta</span><span class="o">.</span><span class="n">get_all_related_objects</span><span class="p">()</span>
<span class="go">[&lt;RelatedObject: polls:choice related to poll&gt;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">_meta</span><span class="o">.</span><span class="n">get_all_related_objects</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">model</span>
<span class="go">&lt;class &#39;polls.models.Choice&#39;&gt;</span>
</pre></div>
</div>
<p>To access the source model, you can use a pattern like this to write code that
will work with both Django 1.8 and older versions:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">relation</span> <span class="ow">in</span> <span class="n">opts</span><span class="o">.</span><span class="n">get_all_related_objects</span><span class="p">():</span>
    <span class="n">to_model</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">relation</span><span class="p">,</span> <span class="s1">&#39;related_model&#39;</span><span class="p">,</span> <span class="n">relation</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
</pre></div>
</div>
<p>Also note that <code class="docutils literal"><span class="pre">get_all_related_objects()</span></code> is deprecated in 1.8. See the
<a class="reference internal" href="../ref/models/meta.html#migrating-old-meta-api"><span class="std std-ref">upgrade guide</span></a> for the new API.</p>
</div>
<div class="section" id="s-database-backend-api">
<span id="database-backend-api"></span><h3>Database backend API<a class="headerlink" href="#database-backend-api" title="Permalink to this headline">¶</a></h3>
<p>The following changes to the database backend API are documented to assist
those writing third-party backends in updating their code:</p>
<ul>
<li><p class="first"><code class="docutils literal"><span class="pre">BaseDatabaseXXX</span></code> classes have been moved to <code class="docutils literal"><span class="pre">django.db.backends.base</span></code>.
Please import them from the new locations:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db.backends.base.base</span> <span class="k">import</span> <span class="n">BaseDatabaseWrapper</span>
<span class="kn">from</span> <span class="nn">django.db.backends.base.client</span> <span class="k">import</span> <span class="n">BaseDatabaseClient</span>
<span class="kn">from</span> <span class="nn">django.db.backends.base.creation</span> <span class="k">import</span> <span class="n">BaseDatabaseCreation</span>
<span class="kn">from</span> <span class="nn">django.db.backends.base.features</span> <span class="k">import</span> <span class="n">BaseDatabaseFeatures</span>
<span class="kn">from</span> <span class="nn">django.db.backends.base.introspection</span> <span class="k">import</span> <span class="n">BaseDatabaseIntrospection</span>
<span class="kn">from</span> <span class="nn">django.db.backends.base.introspection</span> <span class="k">import</span> <span class="n">FieldInfo</span><span class="p">,</span> <span class="n">TableInfo</span>
<span class="kn">from</span> <span class="nn">django.db.backends.base.operations</span> <span class="k">import</span> <span class="n">BaseDatabaseOperations</span>
<span class="kn">from</span> <span class="nn">django.db.backends.base.schema</span> <span class="k">import</span> <span class="n">BaseDatabaseSchemaEditor</span>
<span class="kn">from</span> <span class="nn">django.db.backends.base.validation</span> <span class="k">import</span> <span class="n">BaseDatabaseValidation</span>
</pre></div>
</div>
</li>
<li><p class="first">The <code class="docutils literal"><span class="pre">data_types</span></code>, <code class="docutils literal"><span class="pre">data_types_suffix</span></code>, and
<code class="docutils literal"><span class="pre">data_type_check_constraints</span></code> attributes have moved from the
<code class="docutils literal"><span class="pre">DatabaseCreation</span></code> class to <code class="docutils literal"><span class="pre">DatabaseWrapper</span></code>.</p>
</li>
<li><p class="first">The <code class="docutils literal"><span class="pre">SQLCompiler.as_sql()</span></code> method now takes a <code class="docutils literal"><span class="pre">subquery</span></code> parameter
(<a class="reference external" href="https://code.djangoproject.com/ticket/24164">#24164</a>).</p>
</li>
<li><p class="first">The <code class="docutils literal"><span class="pre">BaseDatabaseOperations.date_interval_sql()</span></code> method now only takes a
<code class="docutils literal"><span class="pre">timedelta</span></code> parameter.</p>
</li>
</ul>
</div>
<div class="section" id="s-id2">
<span id="id2"></span><h3><a class="reference internal" href="../ref/contrib/admin/index.html#module-django.contrib.admin" title="django.contrib.admin: Django's admin site."><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.admin</span></code></a><a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">AdminSite</span></code> no longer takes an <code class="docutils literal"><span class="pre">app_name</span></code> argument and its <code class="docutils literal"><span class="pre">app_name</span></code>
attribute has been removed. The application name is always <code class="docutils literal"><span class="pre">admin</span></code> (as
opposed to the instance name which you can still customize using
<code class="docutils literal"><span class="pre">AdminSite(name=&quot;...&quot;)</span></code>.</li>
<li>The <code class="docutils literal"><span class="pre">ModelAdmin.get_object()</span></code> method (private API) now takes a third
argument named <code class="docutils literal"><span class="pre">from_field</span></code> in order to specify which field should match
the provided <code class="docutils literal"><span class="pre">object_id</span></code>.</li>
<li>The <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.response_delete" title="django.contrib.admin.ModelAdmin.response_delete"><code class="xref py py-meth docutils literal"><span class="pre">ModelAdmin.response_delete()</span></code></a> method
now takes a second argument named <code class="docutils literal"><span class="pre">obj_id</span></code> which is the serialized
identifier used to retrieve the object before deletion.</li>
</ul>
</div>
<div class="section" id="s-default-autoescaping-of-functions-in-django-template-defaultfilters">
<span id="default-autoescaping-of-functions-in-django-template-defaultfilters"></span><h3>Default autoescaping of functions in <code class="docutils literal"><span class="pre">django.template.defaultfilters</span></code><a class="headerlink" href="#default-autoescaping-of-functions-in-django-template-defaultfilters" title="Permalink to this headline">¶</a></h3>
<p>In order to make built-in template filters that output HTML &#8220;safe by default&#8221;
when calling them in Python code, the following functions in
<code class="docutils literal"><span class="pre">django.template.defaultfilters</span></code> have been changed to automatically escape
their input value:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">join</span></code></li>
<li><code class="docutils literal"><span class="pre">linebreaksbr</span></code></li>
<li><code class="docutils literal"><span class="pre">linebreaks_filter</span></code></li>
<li><code class="docutils literal"><span class="pre">linenumbers</span></code></li>
<li><code class="docutils literal"><span class="pre">unordered_list</span></code></li>
<li><code class="docutils literal"><span class="pre">urlize</span></code></li>
<li><code class="docutils literal"><span class="pre">urlizetrunc</span></code></li>
</ul>
<p>You can revert to the old behavior by specifying <code class="docutils literal"><span class="pre">autoescape=False</span></code> if you
are passing trusted content. This change doesn&#8217;t have any effect when using
the corresponding filters in templates.</p>
</div>
<div class="section" id="s-miscellaneous">
<span id="miscellaneous"></span><h3>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Permalink to this headline">¶</a></h3>
<ul>
<li><p class="first"><code class="docutils literal"><span class="pre">connections.queries</span></code> is now a read-only attribute.</p>
</li>
<li><p class="first">Database connections are considered equal only if they&#8217;re the same object.
They aren&#8217;t hashable any more.</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/middleware.html#django.middleware.gzip.GZipMiddleware" title="django.middleware.gzip.GZipMiddleware"><code class="xref py py-class docutils literal"><span class="pre">GZipMiddleware</span></code></a> used to disable compression
for some content types when the request is from Internet Explorer, in order
to work around a bug in IE6 and earlier. This behavior could affect
performance on IE7 and later. It was removed.</p>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">URLField.to_python</span></code> no longer adds a trailing slash to pathless URLs.</p>
</li>
<li><p class="first">The <a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-length"><code class="xref std std-tfilter docutils literal"><span class="pre">length</span></code></a> template filter now returns <code class="docutils literal"><span class="pre">0</span></code> for an undefined
variable, rather than an empty string.</p>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">ForeignKey.default_error_message['invalid']</span></code> has been changed from
<code class="docutils literal"><span class="pre">'%(model)s</span> <span class="pre">instance</span> <span class="pre">with</span> <span class="pre">pk</span> <span class="pre">%(pk)r</span> <span class="pre">does</span> <span class="pre">not</span> <span class="pre">exist.'</span></code> to
<code class="docutils literal"><span class="pre">'%(model)s</span> <span class="pre">instance</span> <span class="pre">with</span> <span class="pre">%(field)s</span> <span class="pre">%(value)r</span> <span class="pre">does</span> <span class="pre">not</span> <span class="pre">exist.'</span></code> If you are
using this message in your own code, please update the list of interpolated
parameters. Internally, Django will continue to provide the
<code class="docutils literal"><span class="pre">pk</span></code> parameter in <code class="docutils literal"><span class="pre">params</span></code> for backwards compatibility.</p>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">UserCreationForm.error_messages['duplicate_username']</span></code> is no longer used.
If you wish to customize that error message, <a class="reference internal" href="../topics/forms/modelforms.html#modelforms-overriding-default-fields"><span class="std std-ref">override it on the form</span></a> using the <code class="docutils literal"><span class="pre">'unique'</span></code> key in
<code class="docutils literal"><span class="pre">Meta.error_messages['username']</span></code> or, if you have a custom form field for
<code class="docutils literal"><span class="pre">'username'</span></code>, using the the <code class="docutils literal"><span class="pre">'unique'</span></code> key in its
<a class="reference internal" href="../ref/forms/fields.html#django.forms.Field.error_messages" title="django.forms.Field.error_messages"><code class="xref py py-attr docutils literal"><span class="pre">error_messages</span></code></a> argument.</p>
</li>
<li><p class="first">The block <code class="docutils literal"><span class="pre">usertools</span></code> in the <code class="docutils literal"><span class="pre">base.html</span></code> template of
<a class="reference internal" href="../ref/contrib/admin/index.html#module-django.contrib.admin" title="django.contrib.admin: Django's admin site."><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.admin</span></code></a> now requires the <code class="docutils literal"><span class="pre">has_permission</span></code> context
variable to be set. If you have any custom admin views that use this
template, update them to pass <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.has_permission" title="django.contrib.admin.AdminSite.has_permission"><code class="xref py py-meth docutils literal"><span class="pre">AdminSite.has_permission()</span></code></a> as this new variable&#8217;s
value or simply include <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.each_context" title="django.contrib.admin.AdminSite.each_context"><code class="xref py py-meth docutils literal"><span class="pre">AdminSite.each_context(request)</span></code></a> in the context.</p>
</li>
<li><p class="first">Internal changes were made to the <a class="reference internal" href="../ref/forms/widgets.html#django.forms.ClearableFileInput" title="django.forms.ClearableFileInput"><code class="xref py py-class docutils literal"><span class="pre">ClearableFileInput</span></code></a>
widget to allow more customization. The undocumented <code class="docutils literal"><span class="pre">url_markup_template</span></code>
attribute was removed in favor of <code class="docutils literal"><span class="pre">template_with_initial</span></code>.</p>
</li>
<li><p class="first">For consistency with other major vendors, the <code class="docutils literal"><span class="pre">en_GB</span></code> locale now has Monday
as the first day of the week.</p>
</li>
<li><p class="first">Seconds have been removed from any locales that had them in <code class="docutils literal"><span class="pre">TIME_FORMAT</span></code>,
<code class="docutils literal"><span class="pre">DATETIME_FORMAT</span></code>, or <code class="docutils literal"><span class="pre">SHORT_DATETIME_FORMAT</span></code>.</p>
</li>
<li><p class="first">The default max size of the Oracle test tablespace has increased from 300M
(or 200M, before 1.7.2) to 500M.</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/urlresolvers.html#django.core.urlresolvers.reverse" title="django.core.urlresolvers.reverse"><code class="xref py py-func docutils literal"><span class="pre">reverse()</span></code></a> and
<a class="reference internal" href="../ref/urlresolvers.html#django.core.urlresolvers.reverse_lazy" title="django.core.urlresolvers.reverse_lazy"><code class="xref py py-func docutils literal"><span class="pre">reverse_lazy()</span></code></a> now return Unicode strings
instead of byte strings.</p>
</li>
<li><p class="first">The <code class="docutils literal"><span class="pre">CacheClass</span></code> shim has been removed from all cache backends.
These aliases were provided for backwards compatibility with Django 1.3.
If you are still using them, please update your project to use the real
class name found in the <a class="reference internal" href="../ref/settings.html#std:setting-CACHES-BACKEND"><code class="xref std std-setting docutils literal"><span class="pre">BACKEND</span></code></a> key of the
<a class="reference internal" href="../ref/settings.html#std:setting-CACHES"><code class="xref std std-setting docutils literal"><span class="pre">CACHES</span></code></a> setting.</p>
</li>
<li><p class="first">By default, <a class="reference internal" href="../ref/django-admin.html#call-command"><span class="std std-ref">call_command</span></a> now always skips the check
framework (unless you pass it <code class="docutils literal"><span class="pre">skip_checks=False</span></code>).</p>
</li>
<li><p class="first">When iterating over lines, <a class="reference internal" href="../ref/files/file.html#django.core.files.File" title="django.core.files.File"><code class="xref py py-class docutils literal"><span class="pre">File</span></code></a> now uses
<a class="reference external" href="https://www.python.org/dev/peps/pep-0278">universal newlines</a>. The following are recognized as ending a line: the
Unix end-of-line convention <code class="docutils literal"><span class="pre">'\n'</span></code>, the Windows convention <code class="docutils literal"><span class="pre">'\r\n'</span></code>, and
the old Macintosh convention <code class="docutils literal"><span class="pre">'\r'</span></code>.</p>
</li>
<li><p class="first">The Memcached cache backends <code class="docutils literal"><span class="pre">MemcachedCache</span></code> and <code class="docutils literal"><span class="pre">PyLibMCCache</span></code> will
delete a key if <code class="docutils literal"><span class="pre">set()</span></code> fails. This is necessary to ensure the <code class="docutils literal"><span class="pre">cache_db</span></code>
session store always fetches the most current session data.</p>
</li>
<li><p class="first">Private APIs <code class="docutils literal"><span class="pre">override_template_loaders</span></code> and <code class="docutils literal"><span class="pre">override_with_test_loader</span></code>
in <code class="docutils literal"><span class="pre">django.test.utils</span></code> were removed. Override <code class="docutils literal"><span class="pre">TEMPLATES</span></code> with
<code class="docutils literal"><span class="pre">override_settings</span></code> instead.</p>
</li>
<li><p class="first">Warnings from the MySQL database backend are no longer converted to
exceptions when <a class="reference internal" href="../ref/settings.html#std:setting-DEBUG"><code class="xref std std-setting docutils literal"><span class="pre">DEBUG</span></code></a> is <code class="docutils literal"><span class="pre">True</span></code>.</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/request-response.html#django.http.HttpRequest" title="django.http.HttpRequest"><code class="xref py py-class docutils literal"><span class="pre">HttpRequest</span></code></a> now has a simplified <code class="docutils literal"><span class="pre">repr</span></code> (e.g.
<code class="docutils literal"><span class="pre">&lt;WSGIRequest:</span> <span class="pre">GET</span> <span class="pre">'/somepath/'&gt;</span></code>). This won&#8217;t change the behavior of
the <a class="reference internal" href="../howto/error-reporting.html#django.views.debug.SafeExceptionReporterFilter" title="django.views.debug.SafeExceptionReporterFilter"><code class="xref py py-class docutils literal"><span class="pre">SafeExceptionReporterFilter</span></code></a> class.</p>
</li>
<li><p class="first">Class-based views that use <a class="reference internal" href="../ref/class-based-views/mixins-editing.html#django.views.generic.edit.ModelFormMixin" title="django.views.generic.edit.ModelFormMixin"><code class="xref py py-class docutils literal"><span class="pre">ModelFormMixin</span></code></a>
will raise an <a class="reference internal" href="../ref/exceptions.html#django.core.exceptions.ImproperlyConfigured" title="django.core.exceptions.ImproperlyConfigured"><code class="xref py py-exc docutils literal"><span class="pre">ImproperlyConfigured</span></code></a> exception
when both the <code class="docutils literal"><span class="pre">fields</span></code> and <code class="docutils literal"><span class="pre">form_class</span></code> attributes are specified.
Previously, <code class="docutils literal"><span class="pre">fields</span></code> was silently ignored.</p>
</li>
<li><p class="first">When following redirects, the test client now raises
<a class="reference internal" href="../ref/exceptions.html#django.test.client.RedirectCycleError" title="django.test.client.RedirectCycleError"><code class="xref py py-exc docutils literal"><span class="pre">RedirectCycleError</span></code></a> if it detects a loop or hits a
maximum redirect limit (rather than passing silently).</p>
</li>
<li><p class="first">Translatable strings set as the <code class="docutils literal"><span class="pre">default</span></code> parameter of the field are cast
to concrete strings later, so the return type of <code class="docutils literal"><span class="pre">Field.get_default()</span></code> is
different in some cases. There is no change to default values which are the
result of a callable.</p>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">GenericIPAddressField.empty_strings_allowed</span></code> is now <code class="docutils literal"><span class="pre">False</span></code>. Database
backends that interpret empty strings as null (only Oracle among the backends
that Django includes) will no longer convert null values back to an empty
string. This is consistent with other backends.</p>
</li>
<li><p class="first">When the <a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.BaseCommand.leave_locale_alone" title="django.core.management.BaseCommand.leave_locale_alone"><code class="xref py py-attr docutils literal"><span class="pre">leave_locale_alone</span></code></a>
attribute is <code class="docutils literal"><span class="pre">False</span></code>, translations are now deactivated instead of forcing
the &#8220;en-us&#8221; locale. In the case your models contained non-English strings and
you counted on English translations to be activated in management commands,
this will not happen any longer. It might be that new database migrations are
generated (once) after migrating to 1.8.</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/utils.html#django.utils.translation.get_language" title="django.utils.translation.get_language"><code class="xref py py-func docutils literal"><span class="pre">django.utils.translation.get_language()</span></code></a> now returns <code class="docutils literal"><span class="pre">None</span></code> instead
of <a class="reference internal" href="../ref/settings.html#std:setting-LANGUAGE_CODE"><code class="xref std std-setting docutils literal"><span class="pre">LANGUAGE_CODE</span></code></a> when translations are temporarily deactivated.</p>
</li>
<li><p class="first">When a translation doesn&#8217;t exist for a specific literal, the fallback is now
taken from the <a class="reference internal" href="../ref/settings.html#std:setting-LANGUAGE_CODE"><code class="xref std std-setting docutils literal"><span class="pre">LANGUAGE_CODE</span></code></a> language (instead of from the
untranslated <code class="docutils literal"><span class="pre">msgid</span></code> message).</p>
</li>
<li><p class="first">The <code class="docutils literal"><span class="pre">name</span></code> field of <a class="reference internal" href="../ref/contrib/contenttypes.html#django.contrib.contenttypes.models.ContentType" title="django.contrib.contenttypes.models.ContentType"><code class="xref py py-class docutils literal"><span class="pre">django.contrib.contenttypes.models.ContentType</span></code></a>
has been removed by a migration and replaced by a property. That means it&#8217;s
not possible to query or filter a <code class="docutils literal"><span class="pre">ContentType</span></code> by this field any longer.</p>
<p>Be careful if you upgrade to Django 1.8 and skip Django 1.7. If you run
<code class="docutils literal"><span class="pre">manage.py</span> <span class="pre">migrate</span> <span class="pre">--fake</span></code>, this migration will be skipped and you&#8217;ll see
a <code class="docutils literal"><span class="pre">RuntimeError:</span> <span class="pre">Error</span> <span class="pre">creating</span> <span class="pre">new</span> <span class="pre">content</span> <span class="pre">types.</span></code> exception because the
<code class="docutils literal"><span class="pre">name</span></code> column won&#8217;t be dropped from the database. Use <code class="docutils literal"><span class="pre">manage.py</span> <span class="pre">migrate</span>
<span class="pre">--fake-initial</span></code> to fake only the initial migration instead.</p>
</li>
<li><p class="first"><a class="reference internal" href="../ref/django-admin.html#django-admin-migrate"><code class="xref std std-djadmin docutils literal"><span class="pre">migrate</span></code></a> now accepts the <a class="reference internal" href="../ref/django-admin.html#django-admin-option---fake-initial"><code class="xref std std-djadminopt docutils literal"><span class="pre">--fake-initial</span></code></a> option to
allow faking initial migrations. In 1.7 initial migrations were always
automatically faked if all tables created in an initial migration already
existed.</p>
</li>
<li><p class="first">An app <em>without</em> migrations with a <code class="docutils literal"><span class="pre">ForeignKey</span></code> to an app <em>with</em> migrations
may now result in a foreign key constraint error when migrating the database
or running tests. In Django 1.7, this could fail silently and result in a
missing constraint. To resolve the error, add migrations to the app without
them.</p>
</li>
</ul>
</div>
</div>
<div class="section" id="s-features-deprecated-in-1-8">
<span id="s-deprecated-features-1-8"></span><span id="features-deprecated-in-1-8"></span><span id="deprecated-features-1-8"></span><h2>Features deprecated in 1.8<a class="headerlink" href="#features-deprecated-in-1-8" title="Permalink to this headline">¶</a></h2>
<div class="section" id="s-selected-methods-in-django-db-models-options-options">
<span id="selected-methods-in-django-db-models-options-options"></span><h3>Selected methods in <code class="docutils literal"><span class="pre">django.db.models.options.Options</span></code><a class="headerlink" href="#selected-methods-in-django-db-models-options-options" title="Permalink to this headline">¶</a></h3>
<p>As part of the formalization of the <code class="docutils literal"><span class="pre">Model._meta</span></code> API (from the
<a class="reference internal" href="../ref/models/meta.html#django.db.models.options.Options" title="django.db.models.options.Options"><code class="xref py py-class docutils literal"><span class="pre">django.db.models.options.Options</span></code></a> class), a number of methods have been
deprecated and will be removed in Django 1.10:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">get_all_field_names()</span></code></li>
<li><code class="docutils literal"><span class="pre">get_all_related_objects()</span></code></li>
<li><code class="docutils literal"><span class="pre">get_all_related_objects_with_model()</span></code></li>
<li><code class="docutils literal"><span class="pre">get_all_related_many_to_many_objects()</span></code></li>
<li><code class="docutils literal"><span class="pre">get_all_related_m2m_objects_with_model()</span></code></li>
<li><code class="docutils literal"><span class="pre">get_concrete_fields_with_model()</span></code></li>
<li><code class="docutils literal"><span class="pre">get_field_by_name()</span></code></li>
<li><code class="docutils literal"><span class="pre">get_fields_with_model()</span></code></li>
<li><code class="docutils literal"><span class="pre">get_m2m_with_model()</span></code></li>
</ul>
<p>A <a class="reference internal" href="../ref/models/meta.html#migrating-old-meta-api"><span class="std std-ref">migration guide</span></a> has been provided to assist
in converting your code from the old API to the new, official API.</p>
</div>
<div class="section" id="s-loading-cycle-and-firstof-template-tags-from-future-library">
<span id="loading-cycle-and-firstof-template-tags-from-future-library"></span><h3>Loading <code class="docutils literal"><span class="pre">cycle</span></code> and <code class="docutils literal"><span class="pre">firstof</span></code> template tags from <code class="docutils literal"><span class="pre">future</span></code> library<a class="headerlink" href="#loading-cycle-and-firstof-template-tags-from-future-library" title="Permalink to this headline">¶</a></h3>
<p>Django 1.6 introduced <code class="docutils literal"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">cycle</span> <span class="pre">from</span> <span class="pre">future</span> <span class="pre">%}</span></code> and
<code class="docutils literal"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">firstof</span> <span class="pre">from</span> <span class="pre">future</span> <span class="pre">%}</span></code> syntax for forward compatibility of the
<a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-cycle"><code class="xref std std-ttag docutils literal"><span class="pre">cycle</span></code></a> and <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-firstof"><code class="xref std std-ttag docutils literal"><span class="pre">firstof</span></code></a> template tags. This syntax is now deprecated
and will be removed in Django 1.10. You can simply remove the
<code class="docutils literal"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">...</span> <span class="pre">from</span> <span class="pre">future</span> <span class="pre">%}</span></code> tags.</p>
</div>
<div class="section" id="s-django-conf-urls-patterns">
<span id="django-conf-urls-patterns"></span><h3><code class="docutils literal"><span class="pre">django.conf.urls.patterns()</span></code><a class="headerlink" href="#django-conf-urls-patterns" title="Permalink to this headline">¶</a></h3>
<p>In the olden days of Django, it was encouraged to reference views as strings
in <code class="docutils literal"><span class="pre">urlpatterns</span></code>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">urlpatterns</span> <span class="o">=</span> <span class="n">patterns</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">,</span>
    <span class="n">url</span><span class="p">(</span><span class="s1">&#39;^$&#39;</span><span class="p">,</span> <span class="s1">&#39;myapp.views.myview&#39;</span><span class="p">),</span>
<span class="p">)</span>
</pre></div>
</div>
<p>and Django would magically import <code class="docutils literal"><span class="pre">myapp.views.myview</span></code> internally and turn
the string into a real function reference. In order to reduce repetition when
referencing many views from the same module, the <code class="docutils literal"><span class="pre">patterns()</span></code> function takes
a required initial <code class="docutils literal"><span class="pre">prefix</span></code> argument which is prepended to all
views-as-strings in that set of <code class="docutils literal"><span class="pre">urlpatterns</span></code>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">urlpatterns</span> <span class="o">=</span> <span class="n">patterns</span><span class="p">(</span><span class="s1">&#39;myapp.views&#39;</span><span class="p">,</span>
    <span class="n">url</span><span class="p">(</span><span class="s1">&#39;^$&#39;</span><span class="p">,</span> <span class="s1">&#39;myview&#39;</span><span class="p">),</span>
    <span class="n">url</span><span class="p">(</span><span class="s1">&#39;^other/$&#39;</span><span class="p">,</span> <span class="s1">&#39;otherview&#39;</span><span class="p">),</span>
<span class="p">)</span>
</pre></div>
</div>
<p>In the modern era, we have updated the tutorial to instead recommend importing
your views module and referencing your view functions (or classes) directly.
This has a number of advantages, all deriving from the fact that we are using
normal Python in place of &#8220;Django String Magic&#8221;: the errors when you mistype a
view name are less obscure, IDEs can help with autocompletion of view names,
etc.</p>
<p>So these days, the above use of the <code class="docutils literal"><span class="pre">prefix</span></code> arg is much more likely to be
written (and is better written) as:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">myapp</span> <span class="k">import</span> <span class="n">views</span>

<span class="n">urlpatterns</span> <span class="o">=</span> <span class="n">patterns</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">,</span>
    <span class="n">url</span><span class="p">(</span><span class="s1">&#39;^$&#39;</span><span class="p">,</span> <span class="n">views</span><span class="o">.</span><span class="n">myview</span><span class="p">),</span>
    <span class="n">url</span><span class="p">(</span><span class="s1">&#39;^other/$&#39;</span><span class="p">,</span> <span class="n">views</span><span class="o">.</span><span class="n">otherview</span><span class="p">),</span>
<span class="p">)</span>
</pre></div>
</div>
<p>Thus <code class="docutils literal"><span class="pre">patterns()</span></code> serves little purpose and is a burden when teaching new users
(answering the newbie&#8217;s question &#8220;why do I need this empty string as the first
argument to <code class="docutils literal"><span class="pre">patterns()</span></code>?&#8221;). For these reasons, we are deprecating it.
Updating your code is as simple as ensuring that <code class="docutils literal"><span class="pre">urlpatterns</span></code> is a list of
<a class="reference internal" href="../ref/urls.html#django.conf.urls.url" title="django.conf.urls.url"><code class="xref py py-func docutils literal"><span class="pre">django.conf.urls.url()</span></code></a> instances. For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.conf.urls</span> <span class="k">import</span> <span class="n">url</span>
<span class="kn">from</span> <span class="nn">myapp</span> <span class="k">import</span> <span class="n">views</span>

<span class="n">urlpatterns</span> <span class="o">=</span> <span class="p">[</span>
    <span class="n">url</span><span class="p">(</span><span class="s1">&#39;^$&#39;</span><span class="p">,</span> <span class="n">views</span><span class="o">.</span><span class="n">myview</span><span class="p">),</span>
    <span class="n">url</span><span class="p">(</span><span class="s1">&#39;^other/$&#39;</span><span class="p">,</span> <span class="n">views</span><span class="o">.</span><span class="n">otherview</span><span class="p">),</span>
<span class="p">]</span>
</pre></div>
</div>
</div>
<div class="section" id="s-passing-a-string-as-view-to-url">
<span id="passing-a-string-as-view-to-url"></span><h3>Passing a string as <code class="docutils literal"><span class="pre">view</span></code> to <a class="reference internal" href="../ref/urls.html#django.conf.urls.url" title="django.conf.urls.url"><code class="xref py py-func docutils literal"><span class="pre">url()</span></code></a><a class="headerlink" href="#passing-a-string-as-view-to-url" title="Permalink to this headline">¶</a></h3>
<p>Related to the previous item, referencing views as strings in the <code class="docutils literal"><span class="pre">url()</span></code>
function is deprecated. Pass the callable view as described in the previous
section instead.</p>
</div>
<div class="section" id="s-template-related-settings">
<span id="template-related-settings"></span><h3>Template-related settings<a class="headerlink" href="#template-related-settings" title="Permalink to this headline">¶</a></h3>
<p>As a consequence of the multiple template engines refactor, several settings
are deprecated in favor of <a class="reference internal" href="../ref/settings.html#std:setting-TEMPLATES"><code class="xref std std-setting docutils literal"><span class="pre">TEMPLATES</span></code></a>:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">ALLOWED_INCLUDE_ROOTS</span></code></li>
<li><code class="docutils literal"><span class="pre">TEMPLATE_CONTEXT_PROCESSORS</span></code></li>
<li><code class="docutils literal"><span class="pre">TEMPLATE_DEBUG</span></code></li>
<li><code class="docutils literal"><span class="pre">TEMPLATE_DIRS</span></code></li>
<li><code class="docutils literal"><span class="pre">TEMPLATE_LOADERS</span></code></li>
<li><code class="docutils literal"><span class="pre">TEMPLATE_STRING_IF_INVALID</span></code></li>
</ul>
</div>
<div class="section" id="s-django-core-context-processors">
<span id="django-core-context-processors"></span><h3><code class="docutils literal"><span class="pre">django.core.context_processors</span></code><a class="headerlink" href="#django-core-context-processors" title="Permalink to this headline">¶</a></h3>
<p>Built-in template context processors have been moved to
<code class="docutils literal"><span class="pre">django.template.context_processors</span></code>.</p>
</div>
<div class="section" id="s-django-test-simpletestcase-urls">
<span id="django-test-simpletestcase-urls"></span><h3><code class="docutils literal"><span class="pre">django.test.SimpleTestCase.urls</span></code><a class="headerlink" href="#django-test-simpletestcase-urls" title="Permalink to this headline">¶</a></h3>
<p>The attribute <a class="reference internal" href="../topics/testing/tools.html#django.test.SimpleTestCase.urls" title="django.test.SimpleTestCase.urls"><code class="xref py py-attr docutils literal"><span class="pre">SimpleTestCase.urls</span></code></a>
for specifying URLconf configuration in tests has been deprecated and will be
removed in Django 1.10. Use <a class="reference internal" href="../topics/testing/tools.html#django.test.override_settings" title="django.test.override_settings"><code class="xref py py-func docutils literal"><span class="pre">&#64;override_settings(ROOT_URLCONF=...)</span></code></a> instead.</p>
</div>
<div class="section" id="s-prefix-argument-to-i18n-patterns">
<span id="prefix-argument-to-i18n-patterns"></span><h3><code class="docutils literal"><span class="pre">prefix</span></code> argument to <a class="reference internal" href="../topics/i18n/translation.html#django.conf.urls.i18n.i18n_patterns" title="django.conf.urls.i18n.i18n_patterns"><code class="xref py py-func docutils literal"><span class="pre">i18n_patterns()</span></code></a><a class="headerlink" href="#prefix-argument-to-i18n-patterns" title="Permalink to this headline">¶</a></h3>
<p>Related to the previous item, the <code class="docutils literal"><span class="pre">prefix</span></code> argument to
<a class="reference internal" href="../topics/i18n/translation.html#django.conf.urls.i18n.i18n_patterns" title="django.conf.urls.i18n.i18n_patterns"><code class="xref py py-func docutils literal"><span class="pre">django.conf.urls.i18n.i18n_patterns()</span></code></a> has been deprecated. Simply pass a
list of <a class="reference internal" href="../ref/urls.html#django.conf.urls.url" title="django.conf.urls.url"><code class="xref py py-func docutils literal"><span class="pre">django.conf.urls.url()</span></code></a> instances instead.</p>
</div>
<div class="section" id="s-using-an-incorrect-count-of-unpacked-values-in-the-for-template-tag">
<span id="using-an-incorrect-count-of-unpacked-values-in-the-for-template-tag"></span><h3>Using an incorrect count of unpacked values in the <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-for"><code class="xref std std-ttag docutils literal"><span class="pre">for</span></code></a> template tag<a class="headerlink" href="#using-an-incorrect-count-of-unpacked-values-in-the-for-template-tag" title="Permalink to this headline">¶</a></h3>
<p>Using an incorrect count of unpacked values in <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-for"><code class="xref std std-ttag docutils literal"><span class="pre">for</span></code></a> tag will raise an
exception rather than fail silently in Django 1.10.</p>
</div>
<div class="section" id="s-passing-a-dotted-path-to-reverse-and-url">
<span id="passing-a-dotted-path-to-reverse-and-url"></span><h3>Passing a dotted path to <a class="reference internal" href="../ref/urlresolvers.html#django.core.urlresolvers.reverse" title="django.core.urlresolvers.reverse"><code class="xref py py-func docutils literal"><span class="pre">reverse()</span></code></a> and <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-url"><code class="xref std std-ttag docutils literal"><span class="pre">url</span></code></a><a class="headerlink" href="#passing-a-dotted-path-to-reverse-and-url" title="Permalink to this headline">¶</a></h3>
<p>Reversing URLs by Python path is an expensive operation as it causes the
path being reversed to be imported. This behavior has also resulted in a
<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="../topics/http/urls.html#naming-url-patterns"><span class="std std-ref">named URL patterns</span></a>
for reversing instead.</p>
<p>If you are using <a class="reference internal" href="../ref/contrib/sitemaps.html#module-django.contrib.sitemaps" title="django.contrib.sitemaps: A framework for generating Google sitemap XML files."><code class="xref py py-mod docutils literal"><span class="pre">django.contrib.sitemaps</span></code></a>, add the <code class="docutils literal"><span class="pre">name</span></code> argument to
the <code class="docutils literal"><span class="pre">url</span></code> that references <a class="reference internal" href="../ref/contrib/sitemaps.html#django.contrib.sitemaps.views.sitemap" title="django.contrib.sitemaps.views.sitemap"><code class="xref py py-func docutils literal"><span class="pre">django.contrib.sitemaps.views.sitemap()</span></code></a>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.contrib.sitemaps.views</span> <span class="k">import</span> <span class="n">sitemap</span>

<span class="n">url</span><span class="p">(</span><span class="s1">r&#39;^sitemap\.xml$&#39;</span><span class="p">,</span> <span class="n">sitemap</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;sitemaps&#39;</span><span class="p">:</span> <span class="n">sitemaps</span><span class="p">},</span>
    <span class="n">name</span><span class="o">=</span><span class="s1">&#39;django.contrib.sitemaps.views.sitemap&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>to ensure compatibility when reversing by Python path is removed in Django 1.10.</p>
<p>Similarly for GIS sitemaps, add <code class="docutils literal"><span class="pre">name='django.contrib.gis.sitemaps.views.kml'</span></code>
or <code class="docutils literal"><span class="pre">name='django.contrib.gis.sitemaps.views.kmz'</span></code>.</p>
<p>If you are using a Python path for the <a class="reference internal" href="../ref/settings.html#std:setting-LOGIN_URL"><code class="xref std std-setting docutils literal"><span class="pre">LOGIN_URL</span></code></a> or
<a class="reference internal" href="../ref/settings.html#std:setting-LOGIN_REDIRECT_URL"><code class="xref std std-setting docutils literal"><span class="pre">LOGIN_REDIRECT_URL</span></code></a> setting, use the name of the <code class="docutils literal"><span class="pre">url()</span></code> instead.</p>
</div>
<div class="section" id="s-aggregate-methods-and-modules">
<span id="aggregate-methods-and-modules"></span><h3>Aggregate methods and modules<a class="headerlink" href="#aggregate-methods-and-modules" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal"><span class="pre">django.db.models.sql.aggregates</span></code> and
<code class="docutils literal"><span class="pre">django.contrib.gis.db.models.sql.aggregates</span></code> modules (both private API), have
been deprecated as <code class="docutils literal"><span class="pre">django.db.models.aggregates</span></code> and
<code class="docutils literal"><span class="pre">django.contrib.gis.db.models.aggregates</span></code> are now also responsible
for SQL generation. The old modules will be removed in Django 1.10.</p>
<p>If you were using the old modules, see <a class="reference internal" href="../ref/models/expressions.html"><span class="doc">Query Expressions</span></a> for instructions on rewriting custom aggregates
using the new stable API.</p>
<p>The following methods and properties of <code class="docutils literal"><span class="pre">django.db.models.sql.query.Query</span></code>
have also been deprecated and the backwards compatibility shims will be removed
in Django 1.10:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">Query.aggregates</span></code>, replaced by <code class="docutils literal"><span class="pre">annotations</span></code>.</li>
<li><code class="docutils literal"><span class="pre">Query.aggregate_select</span></code>, replaced by <code class="docutils literal"><span class="pre">annotation_select</span></code>.</li>
<li><code class="docutils literal"><span class="pre">Query.add_aggregate()</span></code>, replaced by <code class="docutils literal"><span class="pre">add_annotation()</span></code>.</li>
<li><code class="docutils literal"><span class="pre">Query.set_aggregate_mask()</span></code>, replaced by <code class="docutils literal"><span class="pre">set_annotation_mask()</span></code>.</li>
<li><code class="docutils literal"><span class="pre">Query.append_aggregate_mask()</span></code>, replaced by <code class="docutils literal"><span class="pre">append_annotation_mask()</span></code>.</li>
</ul>
</div>
<div class="section" id="s-extending-management-command-arguments-through-command-option-list">
<span id="extending-management-command-arguments-through-command-option-list"></span><h3>Extending management command arguments through <code class="docutils literal"><span class="pre">Command.option_list</span></code><a class="headerlink" href="#extending-management-command-arguments-through-command-option-list" title="Permalink to this headline">¶</a></h3>
<p>Management commands now use <code class="xref py py-mod docutils literal"><span class="pre">argparse</span></code> instead of <code class="xref py py-mod docutils literal"><span class="pre">optparse</span></code> to
parse command-line arguments passed to commands. This also means that the way
to add custom arguments to commands has changed: instead of extending the
<code class="docutils literal"><span class="pre">option_list</span></code> class list, you should now override the
<a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.BaseCommand.add_arguments" title="django.core.management.BaseCommand.add_arguments"><code class="xref py py-meth docutils literal"><span class="pre">add_arguments()</span></code></a> method and add
arguments through <code class="docutils literal"><span class="pre">argparse.add_argument()</span></code>. See
<a class="reference internal" href="../howto/custom-management-commands.html#custom-commands-options"><span class="std std-ref">this example</span></a> for more details.</p>
</div>
<div class="section" id="s-django-core-management-noargscommand">
<span id="django-core-management-noargscommand"></span><h3><code class="docutils literal"><span class="pre">django.core.management.NoArgsCommand</span></code><a class="headerlink" href="#django-core-management-noargscommand" title="Permalink to this headline">¶</a></h3>
<p>The class <a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.NoArgsCommand" title="django.core.management.NoArgsCommand"><code class="xref py py-class docutils literal"><span class="pre">NoArgsCommand</span></code></a> is now deprecated and
will be removed in Django 1.10. Use <a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.BaseCommand" title="django.core.management.BaseCommand"><code class="xref py py-class docutils literal"><span class="pre">BaseCommand</span></code></a>
instead, which takes no arguments by default.</p>
</div>
<div class="section" id="s-listing-all-migrations-in-a-project">
<span id="listing-all-migrations-in-a-project"></span><h3>Listing all migrations in a project<a class="headerlink" href="#listing-all-migrations-in-a-project" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal"><span class="pre">--list</span></code> option of the <a class="reference internal" href="../ref/django-admin.html#django-admin-migrate"><code class="xref std std-djadmin docutils literal"><span class="pre">migrate</span></code></a> management command is
deprecated and will be removed in Django 1.10. Use <a class="reference internal" href="../ref/django-admin.html#django-admin-showmigrations"><code class="xref std std-djadmin docutils literal"><span class="pre">showmigrations</span></code></a>
instead.</p>
</div>
<div class="section" id="s-cache-choices-option-of-modelchoicefield-and-modelmultiplechoicefield">
<span id="cache-choices-option-of-modelchoicefield-and-modelmultiplechoicefield"></span><h3><code class="docutils literal"><span class="pre">cache_choices</span></code> option of <code class="docutils literal"><span class="pre">ModelChoiceField</span></code> and <code class="docutils literal"><span class="pre">ModelMultipleChoiceField</span></code><a class="headerlink" href="#cache-choices-option-of-modelchoicefield-and-modelmultiplechoicefield" title="Permalink to this headline">¶</a></h3>
<p><a class="reference internal" href="../ref/forms/fields.html#django.forms.ModelChoiceField" title="django.forms.ModelChoiceField"><code class="xref py py-class docutils literal"><span class="pre">ModelChoiceField</span></code></a> and
<a class="reference internal" href="../ref/forms/fields.html#django.forms.ModelMultipleChoiceField" title="django.forms.ModelMultipleChoiceField"><code class="xref py py-class docutils literal"><span class="pre">ModelMultipleChoiceField</span></code></a> took an undocumented, untested
option <code class="docutils literal"><span class="pre">cache_choices</span></code>. This cached querysets between multiple renderings of
the same <code class="docutils literal"><span class="pre">Form</span></code> object. This option is subject to an accelerated deprecation
and will be removed in Django 1.9.</p>
</div>
<div class="section" id="s-django-template-resolve-variable">
<span id="django-template-resolve-variable"></span><h3><code class="docutils literal"><span class="pre">django.template.resolve_variable()</span></code><a class="headerlink" href="#django-template-resolve-variable" title="Permalink to this headline">¶</a></h3>
<p>The function has been informally marked as &#8220;Deprecated&#8221; for some time. Replace
<code class="docutils literal"><span class="pre">resolve_variable(path,</span> <span class="pre">context)</span></code> with
<code class="docutils literal"><span class="pre">django.template.Variable(path).resolve(context)</span></code>.</p>
</div>
<div class="section" id="s-django-contrib-webdesign">
<span id="django-contrib-webdesign"></span><h3><code class="docutils literal"><span class="pre">django.contrib.webdesign</span></code><a class="headerlink" href="#django-contrib-webdesign" title="Permalink to this headline">¶</a></h3>
<p>It provided the <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-lorem"><code class="xref std std-ttag docutils literal"><span class="pre">lorem</span></code></a> template tag which is now included in the
built-in tags. Simply remove <code class="docutils literal"><span class="pre">'django.contrib.webdesign'</span></code> from
<a class="reference internal" href="../ref/settings.html#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal"><span class="pre">INSTALLED_APPS</span></code></a> and <code class="docutils literal"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">webdesign</span> <span class="pre">%}</span></code> from your templates.</p>
</div>
<div class="section" id="s-error-message-argument-to-django-forms-regexfield">
<span id="error-message-argument-to-django-forms-regexfield"></span><h3><code class="docutils literal"><span class="pre">error_message</span></code> argument to <code class="docutils literal"><span class="pre">django.forms.RegexField</span></code><a class="headerlink" href="#error-message-argument-to-django-forms-regexfield" title="Permalink to this headline">¶</a></h3>
<p>It provided backwards compatibility for pre-1.0 code, but its functionality is
redundant. Use <code class="docutils literal"><span class="pre">Field.error_messages['invalid']</span></code> instead.</p>
</div>
<div class="section" id="s-old-unordered-list-syntax">
<span id="old-unordered-list-syntax"></span><h3>Old <a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-unordered_list"><code class="xref std std-tfilter docutils literal"><span class="pre">unordered_list</span></code></a> syntax<a class="headerlink" href="#old-unordered-list-syntax" title="Permalink to this headline">¶</a></h3>
<p>An older (pre-1.0), more restrictive and verbose input format for the
<a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-unordered_list"><code class="xref std std-tfilter docutils literal"><span class="pre">unordered_list</span></code></a> template filter has been deprecated:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">[</span><span class="s1">&#39;States&#39;</span><span class="p">,</span> <span class="p">[[</span><span class="s1">&#39;Kansas&#39;</span><span class="p">,</span> <span class="p">[[</span><span class="s1">&#39;Lawrence&#39;</span><span class="p">,</span> <span class="p">[]],</span> <span class="p">[</span><span class="s1">&#39;Topeka&#39;</span><span class="p">,</span> <span class="p">[]]]],</span> <span class="p">[</span><span class="s1">&#39;Illinois&#39;</span><span class="p">,</span> <span class="p">[]]]]</span>
</pre></div>
</div>
<p>Using the new syntax, this becomes:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">[</span><span class="s1">&#39;States&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;Kansas&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;Lawrence&#39;</span><span class="p">,</span> <span class="s1">&#39;Topeka&#39;</span><span class="p">],</span> <span class="s1">&#39;Illinois&#39;</span><span class="p">]]</span>
</pre></div>
</div>
</div>
<div class="section" id="s-django-forms-field-has-changed">
<span id="django-forms-field-has-changed"></span><h3><code class="docutils literal"><span class="pre">django.forms.Field._has_changed()</span></code><a class="headerlink" href="#django-forms-field-has-changed" title="Permalink to this headline">¶</a></h3>
<p>Rename this method to <a class="reference internal" href="../ref/forms/fields.html#django.forms.Field.has_changed" title="django.forms.Field.has_changed"><code class="xref py py-meth docutils literal"><span class="pre">has_changed()</span></code></a> by removing the
leading underscore. The old name will still work until Django 1.10.</p>
</div>
<div class="section" id="s-django-utils-html-remove-tags-and-removetags-template-filter">
<span id="django-utils-html-remove-tags-and-removetags-template-filter"></span><h3><code class="docutils literal"><span class="pre">django.utils.html.remove_tags()</span></code> and <code class="docutils literal"><span class="pre">removetags</span></code> template filter<a class="headerlink" href="#django-utils-html-remove-tags-and-removetags-template-filter" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal"><span class="pre">django.utils.html.remove_tags()</span></code> as well as the template filter
<code class="docutils literal"><span class="pre">removetags</span></code> have been deprecated as they cannot guarantee safe output. Their
existence is likely to lead to their use in security-sensitive contexts where
they are not actually safe.</p>
<p>The unused and undocumented <code class="docutils literal"><span class="pre">django.utils.html.strip_entities()</span></code> function has
also been deprecated.</p>
</div>
<div class="section" id="s-is-admin-site-argument-to-django-contrib-auth-views-password-reset">
<span id="is-admin-site-argument-to-django-contrib-auth-views-password-reset"></span><h3><code class="docutils literal"><span class="pre">is_admin_site</span></code> argument to <code class="docutils literal"><span class="pre">django.contrib.auth.views.password_reset()</span></code><a class="headerlink" href="#is-admin-site-argument-to-django-contrib-auth-views-password-reset" title="Permalink to this headline">¶</a></h3>
<p>It&#8217;s a legacy option that should no longer be necessary.</p>
</div>
<div class="section" id="s-subfieldbase">
<span id="subfieldbase"></span><h3><code class="docutils literal"><span class="pre">SubfieldBase</span></code><a class="headerlink" href="#subfieldbase" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal"><span class="pre">django.db.models.fields.subclassing.SubfieldBase</span></code> has been deprecated and
will be removed in Django 1.10. Historically, it was used to handle fields where
type conversion was needed when loading from the database, but it was not used
in <code class="docutils literal"><span class="pre">.values()</span></code> calls or in aggregates. It has been replaced with
<a class="reference internal" href="../ref/models/fields.html#django.db.models.Field.from_db_value" title="django.db.models.Field.from_db_value"><code class="xref py py-meth docutils literal"><span class="pre">from_db_value()</span></code></a>.</p>
<p>The new approach doesn&#8217;t call the <a class="reference internal" href="../ref/models/fields.html#django.db.models.Field.to_python" title="django.db.models.Field.to_python"><code class="xref py py-meth docutils literal"><span class="pre">to_python()</span></code></a>
method on assignment as was the case with <code class="docutils literal"><span class="pre">SubfieldBase</span></code>. If you need that
behavior, reimplement the <code class="docutils literal"><span class="pre">Creator</span></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&#8217;s source code</a>
in your project.</p>
</div>
<div class="section" id="s-django-utils-checksums">
<span id="django-utils-checksums"></span><h3><code class="docutils literal"><span class="pre">django.utils.checksums</span></code><a class="headerlink" href="#django-utils-checksums" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal"><span class="pre">django.utils.checksums</span></code> module has been deprecated and will be removed
in Django 1.10. The functionality it provided (validating checksum using the
Luhn algorithm) was undocumented and not used in Django. The module has been
moved to the <a class="reference external" href="https://pypi.python.org/pypi/django-localflavor">django-localflavor</a> package (version 1.1+).</p>
</div>
<div class="section" id="s-inlineadminform-original-content-type-id">
<span id="inlineadminform-original-content-type-id"></span><h3><code class="docutils literal"><span class="pre">InlineAdminForm.original_content_type_id</span></code><a class="headerlink" href="#inlineadminform-original-content-type-id" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal"><span class="pre">original_content_type_id</span></code> attribute on <code class="docutils literal"><span class="pre">InlineAdminForm</span></code> has been
deprecated and will be removed in Django 1.10. Historically, it was used
to construct the &#8220;view on site&#8221; URL. This URL is now accessible using the
<code class="docutils literal"><span class="pre">absolute_url</span></code> attribute of the form.</p>
</div>
<div class="section" id="s-django-views-generic-edit-formmixin-get-form-s-form-class-argument">
<span id="django-views-generic-edit-formmixin-get-form-s-form-class-argument"></span><h3><code class="docutils literal"><span class="pre">django.views.generic.edit.FormMixin.get_form()</span></code>’s <code class="docutils literal"><span class="pre">form_class</span></code> argument<a class="headerlink" href="#django-views-generic-edit-formmixin-get-form-s-form-class-argument" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal"><span class="pre">FormMixin</span></code> subclasses that override the <code class="docutils literal"><span class="pre">get_form()</span></code> method should make
sure to provide a default value for the <code class="docutils literal"><span class="pre">form_class</span></code> argument since it&#8217;s
now optional.</p>
</div>
<div class="section" id="s-rendering-templates-loaded-by-get-template-with-a-context">
<span id="rendering-templates-loaded-by-get-template-with-a-context"></span><h3>Rendering templates loaded by <a class="reference internal" href="../topics/templates.html#django.template.loader.get_template" title="django.template.loader.get_template"><code class="xref py py-func docutils literal"><span class="pre">get_template()</span></code></a> with a <a class="reference internal" href="../ref/templates/api.html#django.template.Context" title="django.template.Context"><code class="xref py py-class docutils literal"><span class="pre">Context</span></code></a><a class="headerlink" href="#rendering-templates-loaded-by-get-template-with-a-context" title="Permalink to this headline">¶</a></h3>
<p>The return type of <a class="reference internal" href="../topics/templates.html#django.template.loader.get_template" title="django.template.loader.get_template"><code class="xref py py-func docutils literal"><span class="pre">get_template()</span></code></a> has changed
in Django 1.8: instead of a <a class="reference internal" href="../ref/templates/api.html#django.template.Template" title="django.template.Template"><code class="xref py py-class docutils literal"><span class="pre">django.template.Template</span></code></a>, it returns a
<code class="docutils literal"><span class="pre">Template</span></code> instance whose exact type depends on which backend loaded it.</p>
<p>Both classes provide a <code class="docutils literal"><span class="pre">render()</span></code> method, however, the former takes a
<a class="reference internal" href="../ref/templates/api.html#django.template.Context" title="django.template.Context"><code class="xref py py-class docutils literal"><span class="pre">django.template.Context</span></code></a> as an argument while the latter expects a
<code class="xref py py-class docutils literal"><span class="pre">dict</span></code>. This change is enforced through a deprecation path for Django
templates.</p>
<p>Since it&#8217;s easier to understand with examples, the <a class="reference internal" href="../ref/templates/upgrading.html#get-template-upgrade-django-18"><span class="std std-ref">upgrade guide</span></a> shows how to adapt affected code.</p>
<p>All this also applies to <a class="reference internal" href="../topics/templates.html#django.template.loader.select_template" title="django.template.loader.select_template"><code class="xref py py-func docutils literal"><span class="pre">select_template()</span></code></a>.</p>
</div>
<div class="section" id="s-template-and-context-classes-in-template-responses">
<span id="template-and-context-classes-in-template-responses"></span><h3><a class="reference internal" href="../ref/templates/api.html#django.template.Template" title="django.template.Template"><code class="xref py py-class docutils literal"><span class="pre">Template</span></code></a> and <a class="reference internal" href="../ref/templates/api.html#django.template.Context" title="django.template.Context"><code class="xref py py-class docutils literal"><span class="pre">Context</span></code></a> classes in template responses<a class="headerlink" href="#template-and-context-classes-in-template-responses" title="Permalink to this headline">¶</a></h3>
<p>Some methods of <a class="reference internal" href="../ref/template-response.html#django.template.response.SimpleTemplateResponse" title="django.template.response.SimpleTemplateResponse"><code class="xref py py-class docutils literal"><span class="pre">SimpleTemplateResponse</span></code></a> and
<a class="reference internal" href="../ref/template-response.html#django.template.response.TemplateResponse" title="django.template.response.TemplateResponse"><code class="xref py py-class docutils literal"><span class="pre">TemplateResponse</span></code></a> accepted
<a class="reference internal" href="../ref/templates/api.html#django.template.Context" title="django.template.Context"><code class="xref py py-class docutils literal"><span class="pre">django.template.Context</span></code></a> and <a class="reference internal" href="../ref/templates/api.html#django.template.Template" title="django.template.Template"><code class="xref py py-class docutils literal"><span class="pre">django.template.Template</span></code></a> objects
as arguments. They should now receive <code class="xref py py-class docutils literal"><span class="pre">dict</span></code> and backend-dependent
template objects respectively.</p>
<p>This also applies to the return types if you have subclassed either template
response class.</p>
<p>Check the <a class="reference internal" href="../ref/template-response.html"><span class="doc">template response API documentation</span></a>
for details.</p>
</div>
<div class="section" id="s-current-app-argument-of-template-related-apis">
<span id="current-app-argument-of-template-related-apis"></span><h3><code class="docutils literal"><span class="pre">current_app</span></code> argument of template-related APIs<a class="headerlink" href="#current-app-argument-of-template-related-apis" title="Permalink to this headline">¶</a></h3>
<p>The following functions and classes will no longer accept a <code class="docutils literal"><span class="pre">current_app</span></code>
parameter to set an URL namespace in Django 1.10:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">django.shortcuts.render()</span></code></li>
<li><code class="docutils literal"><span class="pre">django.template.Context()</span></code></li>
<li><code class="docutils literal"><span class="pre">django.template.RequestContext()</span></code></li>
<li><code class="docutils literal"><span class="pre">django.template.response.TemplateResponse()</span></code></li>
</ul>
<p>Set <code class="docutils literal"><span class="pre">request.current_app</span></code> instead, where <code class="docutils literal"><span class="pre">request</span></code> is the first argument
to these functions or classes. If you&#8217;re using a plain <code class="docutils literal"><span class="pre">Context</span></code>, use a
<code class="docutils literal"><span class="pre">RequestContext</span></code> instead.</p>
</div>
<div class="section" id="s-dictionary-and-context-instance-arguments-of-rendering-functions">
<span id="dictionary-and-context-instance-arguments-of-rendering-functions"></span><h3><code class="docutils literal"><span class="pre">dictionary</span></code> and <code class="docutils literal"><span class="pre">context_instance</span></code> arguments of rendering functions<a class="headerlink" href="#dictionary-and-context-instance-arguments-of-rendering-functions" title="Permalink to this headline">¶</a></h3>
<p>The following functions will no longer accept the <code class="docutils literal"><span class="pre">dictionary</span></code> and
<code class="docutils literal"><span class="pre">context_instance</span></code> parameters in Django 1.10:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">django.shortcuts.render()</span></code></li>
<li><code class="docutils literal"><span class="pre">django.shortcuts.render_to_response()</span></code></li>
<li><code class="docutils literal"><span class="pre">django.template.loader.render_to_string()</span></code></li>
</ul>
<p>Use the <code class="docutils literal"><span class="pre">context</span></code> parameter instead. When <code class="docutils literal"><span class="pre">dictionary</span></code> is passed as a
positional argument, which is the most common idiom, no changes are needed.</p>
<p>If you&#8217;re passing a <a class="reference internal" href="../ref/templates/api.html#django.template.Context" title="django.template.Context"><code class="xref py py-class docutils literal"><span class="pre">Context</span></code></a> in <code class="docutils literal"><span class="pre">context_instance</span></code>,
pass a <code class="xref py py-class docutils literal"><span class="pre">dict</span></code> in the <code class="docutils literal"><span class="pre">context</span></code> parameter instead. If you&#8217;re passing a
<a class="reference internal" href="../ref/templates/api.html#django.template.RequestContext" title="django.template.RequestContext"><code class="xref py py-class docutils literal"><span class="pre">RequestContext</span></code></a>, pass the request separately in the
<code class="docutils literal"><span class="pre">request</span></code> parameter.</p>
<p>If you&#8217;re using <code class="docutils literal"><span class="pre">context_instance=RequestContext(request))</span></code> with
<code class="docutils literal"><span class="pre">render_to_response()</span></code>, use <a class="reference internal" href="../topics/http/shortcuts.html#django.shortcuts.render" title="django.shortcuts.render"><code class="xref py py-func docutils literal"><span class="pre">django.shortcuts.render()</span></code></a>, which always
makes <code class="docutils literal"><span class="pre">RequestContext</span></code> available, instead. For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.shortcuts</span> <span class="k">import</span> <span class="n">render_to_response</span>
<span class="kn">from</span> <span class="nn">django.template</span> <span class="k">import</span> <span class="n">RequestContext</span>
<span class="n">render_to_response</span><span class="p">(</span><span class="s1">&#39;template.html&#39;</span><span class="p">,</span> <span class="p">{</span><span class="o">...</span><span class="p">},</span> <span class="n">context_instance</span><span class="o">=</span><span class="n">RequestContext</span><span class="p">(</span><span class="n">request</span><span class="p">))</span>
</pre></div>
</div>
<p>becomes:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.shortcuts</span> <span class="k">import</span> <span class="n">render</span>
<span class="n">render</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="s1">&#39;template.html&#39;</span><span class="p">,</span> <span class="p">{</span><span class="o">...</span><span class="p">})</span>
</pre></div>
</div>
</div>
<div class="section" id="s-dirs-argument-of-template-finding-functions">
<span id="dirs-argument-of-template-finding-functions"></span><h3><code class="docutils literal"><span class="pre">dirs</span></code> argument of template-finding functions<a class="headerlink" href="#dirs-argument-of-template-finding-functions" title="Permalink to this headline">¶</a></h3>
<p>The following functions will no longer accept a <code class="docutils literal"><span class="pre">dirs</span></code> parameter to override
<code class="docutils literal"><span class="pre">TEMPLATE_DIRS</span></code> in Django 1.10:</p>
<ul class="simple">
<li><a class="reference internal" href="../topics/templates.html#django.template.loader.get_template" title="django.template.loader.get_template"><code class="xref py py-func docutils literal"><span class="pre">django.template.loader.get_template()</span></code></a></li>
<li><a class="reference internal" href="../topics/templates.html#django.template.loader.select_template" title="django.template.loader.select_template"><code class="xref py py-func docutils literal"><span class="pre">django.template.loader.select_template()</span></code></a></li>
<li><a class="reference internal" href="../topics/http/shortcuts.html#django.shortcuts.render" title="django.shortcuts.render"><code class="xref py py-func docutils literal"><span class="pre">django.shortcuts.render()</span></code></a></li>
<li><a class="reference internal" href="../topics/http/shortcuts.html#django.shortcuts.render_to_response" title="django.shortcuts.render_to_response"><code class="xref py py-func docutils literal"><span class="pre">django.shortcuts.render_to_response()</span></code></a></li>
</ul>
<p>The parameter didn&#8217;t work consistently across different template loaders and
didn&#8217;t work for included templates.</p>
</div>
<div class="section" id="s-django-template-loader-baseloader">
<span id="django-template-loader-baseloader"></span><h3><code class="docutils literal"><span class="pre">django.template.loader.BaseLoader</span></code><a class="headerlink" href="#django-template-loader-baseloader" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal"><span class="pre">django.template.loader.BaseLoader</span></code> was renamed to
<code class="docutils literal"><span class="pre">django.template.loaders.base.Loader</span></code>. If you&#8217;ve written a custom template
loader that inherits <code class="docutils literal"><span class="pre">BaseLoader</span></code>, you must inherit <code class="docutils literal"><span class="pre">Loader</span></code> instead.</p>
</div>
<div class="section" id="s-django-test-utils-testtemplateloader">
<span id="django-test-utils-testtemplateloader"></span><h3><code class="docutils literal"><span class="pre">django.test.utils.TestTemplateLoader</span></code><a class="headerlink" href="#django-test-utils-testtemplateloader" title="Permalink to this headline">¶</a></h3>
<p>Private API <code class="docutils literal"><span class="pre">django.test.utils.TestTemplateLoader</span></code> is deprecated in favor of
<code class="docutils literal"><span class="pre">django.template.loaders.locmem.Loader</span></code> and will be removed in Django 1.9.</p>
</div>
<div class="section" id="s-support-for-the-max-length-argument-on-custom-storage-classes">
<span id="s-storage-max-length-update"></span><span id="support-for-the-max-length-argument-on-custom-storage-classes"></span><span id="storage-max-length-update"></span><h3>Support for the <code class="docutils literal"><span class="pre">max_length</span></code> argument on custom <code class="docutils literal"><span class="pre">Storage</span></code> classes<a class="headerlink" href="#support-for-the-max-length-argument-on-custom-storage-classes" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal"><span class="pre">Storage</span></code> subclasses should add <code class="docutils literal"><span class="pre">max_length=None</span></code> as a parameter to
<a class="reference internal" href="../ref/files/storage.html#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"><span class="pre">get_available_name()</span></code></a> and/or
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.save" title="django.core.files.storage.Storage.save"><code class="xref py py-meth docutils literal"><span class="pre">save()</span></code></a> if they override either method.
Support for storages that do not accept this argument will be removed in
Django 1.10.</p>
</div>
<div class="section" id="s-qn-replaced-by-compiler">
<span id="qn-replaced-by-compiler"></span><h3><code class="docutils literal"><span class="pre">qn</span></code> replaced by <code class="docutils literal"><span class="pre">compiler</span></code><a class="headerlink" href="#qn-replaced-by-compiler" title="Permalink to this headline">¶</a></h3>
<p>In previous Django versions, various internal ORM methods (mostly <code class="docutils literal"><span class="pre">as_sql</span></code>
methods) accepted a <code class="docutils literal"><span class="pre">qn</span></code> (for &#8220;quote name&#8221;) argument, which was a reference
to a function that quoted identifiers for sending to the database. In Django
1.8, that argument has been renamed to <code class="docutils literal"><span class="pre">compiler</span></code> and is now a full
<code class="docutils literal"><span class="pre">SQLCompiler</span></code> instance. For backwards-compatibility, calling a
<code class="docutils literal"><span class="pre">SQLCompiler</span></code> instance performs the same name-quoting that the <code class="docutils literal"><span class="pre">qn</span></code>
function used to. However, this backwards-compatibility shim is immediately
deprecated: you should rename your <code class="docutils literal"><span class="pre">qn</span></code> arguments to <code class="docutils literal"><span class="pre">compiler</span></code>, and call
<code class="docutils literal"><span class="pre">compiler.quote_name_unless_alias(...)</span></code> where you previously called
<code class="docutils literal"><span class="pre">qn(...)</span></code>.</p>
</div>
<div class="section" id="s-default-value-of-redirectview-permanent">
<span id="default-value-of-redirectview-permanent"></span><h3>Default value of <code class="docutils literal"><span class="pre">RedirectView.permanent</span></code><a class="headerlink" href="#default-value-of-redirectview-permanent" title="Permalink to this headline">¶</a></h3>
<p>The default value of the
<a class="reference internal" href="../ref/class-based-views/base.html#django.views.generic.base.RedirectView.permanent" title="django.views.generic.base.RedirectView.permanent"><code class="xref py py-attr docutils literal"><span class="pre">RedirectView.permanent</span></code></a>
attribute will change from <code class="docutils literal"><span class="pre">True</span></code> to <code class="docutils literal"><span class="pre">False</span></code> in Django 1.9.</p>
</div>
<div class="section" id="s-using-authenticationmiddleware-without-sessionauthenticationmiddleware">
<span id="using-authenticationmiddleware-without-sessionauthenticationmiddleware"></span><h3>Using <code class="docutils literal"><span class="pre">AuthenticationMiddleware</span></code> without <code class="docutils literal"><span class="pre">SessionAuthenticationMiddleware</span></code><a class="headerlink" href="#using-authenticationmiddleware-without-sessionauthenticationmiddleware" title="Permalink to this headline">¶</a></h3>
<p><a class="reference internal" href="../ref/middleware.html#django.contrib.auth.middleware.SessionAuthenticationMiddleware" title="django.contrib.auth.middleware.SessionAuthenticationMiddleware"><code class="xref py py-class docutils literal"><span class="pre">django.contrib.auth.middleware.SessionAuthenticationMiddleware</span></code></a> was
added in Django 1.7. In Django 1.7.2, its functionality was moved to
<code class="docutils literal"><span class="pre">auth.get_user()</span></code> and, for backwards compatibility, enabled only if
<code class="docutils literal"><span class="pre">'django.contrib.auth.middleware.SessionAuthenticationMiddleware'</span></code> appears in
<a class="reference internal" href="../ref/settings.html#std:setting-MIDDLEWARE_CLASSES"><code class="xref std std-setting docutils literal"><span class="pre">MIDDLEWARE_CLASSES</span></code></a>.</p>
<p>In Django 1.10, session verification will be enabled regardless of whether or not
<code class="docutils literal"><span class="pre">SessionAuthenticationMiddleware</span></code> is enabled (at which point
<code class="docutils literal"><span class="pre">SessionAuthenticationMiddleware</span></code> will have no significance). You can add it
to your <code class="docutils literal"><span class="pre">MIDDLEWARE_CLASSES</span></code> sometime before then to opt-in. Please read the
<a class="reference internal" href="../topics/auth/default.html#session-invalidation-on-password-change"><span class="std std-ref">upgrade considerations</span></a> first.</p>
</div>
<div class="section" id="s-django-contrib-sitemaps-flatpagesitemap">
<span id="django-contrib-sitemaps-flatpagesitemap"></span><h3><code class="docutils literal"><span class="pre">django.contrib.sitemaps.FlatPageSitemap</span></code><a class="headerlink" href="#django-contrib-sitemaps-flatpagesitemap" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal"><span class="pre">django.contrib.sitemaps.FlatPageSitemap</span></code> has moved to
<code class="docutils literal"><span class="pre">django.contrib.flatpages.sitemaps.FlatPageSitemap</span></code>. The old import location
is deprecated and will be removed in Django 1.9.</p>
</div>
<div class="section" id="s-model-field-related">
<span id="model-field-related"></span><h3>Model <code class="docutils literal"><span class="pre">Field.related</span></code><a class="headerlink" href="#model-field-related" title="Permalink to this headline">¶</a></h3>
<p>Private attribute <code class="docutils literal"><span class="pre">django.db.models.Field.related</span></code> is deprecated in favor
of <code class="docutils literal"><span class="pre">Field.rel</span></code>.  The latter is an instance of
<code class="docutils literal"><span class="pre">django.db.models.fields.related.ForeignObjectRel</span></code> which replaces
<code class="docutils literal"><span class="pre">django.db.models.related.RelatedObject</span></code>. The <code class="docutils literal"><span class="pre">django.db.models.related</span></code>
module has been removed and the <code class="docutils literal"><span class="pre">Field.related</span></code> attribute will be removed in
Django 1.10.</p>
</div>
<div class="section" id="s-ssi-template-tag">
<span id="ssi-template-tag"></span><h3><code class="docutils literal"><span class="pre">ssi</span></code> template tag<a class="headerlink" href="#ssi-template-tag" title="Permalink to this headline">¶</a></h3>
<p>The <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-ssi"><code class="xref std std-ttag docutils literal"><span class="pre">ssi</span></code></a> template tag allows files to be included in a template by
absolute path. This is of limited use in most deployment situations, and
the <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-include"><code class="xref std std-ttag docutils literal"><span class="pre">include</span></code></a> tag often makes more sense. This tag is now deprecated and
will be removed in Django 1.10.</p>
</div>
<div class="section" id="s-as-comparison-operator-in-if-template-tag">
<span id="as-comparison-operator-in-if-template-tag"></span><h3><code class="docutils literal"><span class="pre">=</span></code> as comparison operator in <code class="docutils literal"><span class="pre">if</span></code> template tag<a class="headerlink" href="#as-comparison-operator-in-if-template-tag" title="Permalink to this headline">¶</a></h3>
<p>Using a single equals sign with the <code class="docutils literal"><span class="pre">{%</span> <span class="pre">if</span> <span class="pre">%}</span></code> template tag for equality
testing was undocumented and untested. It&#8217;s now deprecated in favor of <code class="docutils literal"><span class="pre">==</span></code>.</p>
</div>
<div class="section" id="s-foo-s-syntax-in-modelformmixin-success-url">
<span id="foo-s-syntax-in-modelformmixin-success-url"></span><h3><code class="docutils literal"><span class="pre">%(&lt;foo&gt;)s</span></code> syntax in <code class="docutils literal"><span class="pre">ModelFormMixin.success_url</span></code><a class="headerlink" href="#foo-s-syntax-in-modelformmixin-success-url" title="Permalink to this headline">¶</a></h3>
<p>The legacy <code class="docutils literal"><span class="pre">%(&lt;foo&gt;)s</span></code> syntax in <a class="reference internal" href="../ref/class-based-views/mixins-editing.html#django.views.generic.edit.ModelFormMixin.success_url" title="django.views.generic.edit.ModelFormMixin.success_url"><code class="xref py py-attr docutils literal"><span class="pre">ModelFormMixin.success_url</span></code></a> is deprecated and
will be removed in Django 1.10.</p>
</div>
<div class="section" id="s-geoqueryset-aggregate-methods">
<span id="geoqueryset-aggregate-methods"></span><h3><code class="docutils literal"><span class="pre">GeoQuerySet</span></code> aggregate methods<a class="headerlink" href="#geoqueryset-aggregate-methods" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal"><span class="pre">collect()</span></code>, <code class="docutils literal"><span class="pre">extent()</span></code>, <code class="docutils literal"><span class="pre">extent3d()</span></code>, <code class="docutils literal"><span class="pre">make_line()</span></code>, and
<code class="docutils literal"><span class="pre">unionagg()</span></code> aggregate methods are deprecated and should be replaced by their
function-based aggregate equivalents (<code class="docutils literal"><span class="pre">Collect</span></code>, <code class="docutils literal"><span class="pre">Extent</span></code>, <code class="docutils literal"><span class="pre">Extent3D</span></code>,
<code class="docutils literal"><span class="pre">MakeLine</span></code>, and <code class="docutils literal"><span class="pre">Union</span></code>).</p>
</div>
<div class="section" id="s-signature-of-the-allow-migrate-router-method">
<span id="s-deprecated-signature-of-allow-migrate"></span><span id="signature-of-the-allow-migrate-router-method"></span><span id="deprecated-signature-of-allow-migrate"></span><h3>Signature of the <code class="docutils literal"><span class="pre">allow_migrate</span></code> router method<a class="headerlink" href="#signature-of-the-allow-migrate-router-method" title="Permalink to this headline">¶</a></h3>
<p>The signature of the <a class="reference internal" href="../topics/db/multi-db.html#allow_migrate" title="allow_migrate"><code class="xref py py-meth docutils literal"><span class="pre">allow_migrate()</span></code></a> method of database routers has
changed from <code class="docutils literal"><span class="pre">allow_migrate(db,</span> <span class="pre">model)</span></code> to
<code class="docutils literal"><span class="pre">allow_migrate(db,</span> <span class="pre">app_label,</span> <span class="pre">model_name=None,</span> <span class="pre">**hints)</span></code>.</p>
<p>When <code class="docutils literal"><span class="pre">model_name</span></code> is set, the value that was previously given through the
<code class="docutils literal"><span class="pre">model</span></code> positional argument may now be found inside the <code class="docutils literal"><span class="pre">hints</span></code> dictionary
under the key <code class="docutils literal"><span class="pre">'model'</span></code>.</p>
<p>After switching to the new signature the router will also be called by the
<a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunPython" title="django.db.migrations.operations.RunPython"><code class="xref py py-class docutils literal"><span class="pre">RunPython</span></code></a> and
<a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunSQL" title="django.db.migrations.operations.RunSQL"><code class="xref py py-class docutils literal"><span class="pre">RunSQL</span></code></a> operations.</p>
</div>
</div>
<div class="section" id="s-features-removed-in-1-8">
<span id="s-removed-features-1-8"></span><span id="features-removed-in-1-8"></span><span id="removed-features-1-8"></span><h2>Features removed in 1.8<a class="headerlink" href="#features-removed-in-1-8" title="Permalink to this headline">¶</a></h2>
<p>These features have reached the end of their deprecation cycle and so have been
removed in Django 1.8 (please see the <a class="reference internal" href="../internals/deprecation.html#deprecation-removed-in-1-8"><span class="std std-ref">deprecation timeline</span></a> for more details):</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">django.contrib.comments</span></code> is removed.</li>
<li>The following transaction management APIs are removed:<ul>
<li><code class="docutils literal"><span class="pre">TransactionMiddleware</span></code></li>
<li>the decorators and context managers <code class="docutils literal"><span class="pre">autocommit</span></code>, <code class="docutils literal"><span class="pre">commit_on_success</span></code>,
and <code class="docutils literal"><span class="pre">commit_manually</span></code>, defined in <code class="docutils literal"><span class="pre">django.db.transaction</span></code></li>
<li>the functions <code class="docutils literal"><span class="pre">commit_unless_managed</span></code> and <code class="docutils literal"><span class="pre">rollback_unless_managed</span></code>,
also defined in <code class="docutils literal"><span class="pre">django.db.transaction</span></code></li>
<li>the <code class="docutils literal"><span class="pre">TRANSACTIONS_MANAGED</span></code> setting</li>
</ul>
</li>
<li>The <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-cycle"><code class="xref std std-ttag docutils literal"><span class="pre">cycle</span></code></a> and <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-firstof"><code class="xref std std-ttag docutils literal"><span class="pre">firstof</span></code></a> template tags auto-escape their
arguments.</li>
<li>The <code class="docutils literal"><span class="pre">SEND_BROKEN_LINK_EMAILS</span></code> setting is removed.</li>
<li><code class="docutils literal"><span class="pre">django.middleware.doc.XViewMiddleware</span></code> is removed.</li>
<li>The <code class="docutils literal"><span class="pre">Model._meta.module_name</span></code> alias is removed.</li>
<li>The backward compatible shims introduced to rename <code class="docutils literal"><span class="pre">get_query_set</span></code>
and similar queryset methods are removed. This affects the following classes:
<code class="docutils literal"><span class="pre">BaseModelAdmin</span></code>, <code class="docutils literal"><span class="pre">ChangeList</span></code>, <code class="docutils literal"><span class="pre">BaseCommentNode</span></code>,
<code class="docutils literal"><span class="pre">GenericForeignKey</span></code>, <code class="docutils literal"><span class="pre">Manager</span></code>, <code class="docutils literal"><span class="pre">SingleRelatedObjectDescriptor</span></code> and
<code class="docutils literal"><span class="pre">ReverseSingleRelatedObjectDescriptor</span></code>.</li>
<li>The backward compatible shims introduced to rename the attributes
<code class="docutils literal"><span class="pre">ChangeList.root_query_set</span></code> and <code class="docutils literal"><span class="pre">ChangeList.query_set</span></code> are removed.</li>
<li><code class="docutils literal"><span class="pre">django.views.defaults.shortcut</span></code> and <code class="docutils literal"><span class="pre">django.conf.urls.shortcut</span></code> are
removed.</li>
<li>Support for the Python Imaging Library (PIL) module is removed.</li>
<li>The following private APIs are removed:<ul>
<li><code class="docutils literal"><span class="pre">django.db.backend</span></code></li>
<li><code class="docutils literal"><span class="pre">django.db.close_connection()</span></code></li>
<li><code class="docutils literal"><span class="pre">django.db.backends.creation.BaseDatabaseCreation.set_autocommit()</span></code></li>
<li><code class="docutils literal"><span class="pre">django.db.transaction.is_managed()</span></code></li>
<li><code class="docutils literal"><span class="pre">django.db.transaction.managed()</span></code></li>
</ul>
</li>
<li><code class="docutils literal"><span class="pre">django.forms.widgets.RadioInput</span></code> is removed.</li>
<li>The module <code class="docutils literal"><span class="pre">django.test.simple</span></code> and the class
<code class="docutils literal"><span class="pre">django.test.simple.DjangoTestSuiteRunner</span></code> are removed.</li>
<li>The module <code class="docutils literal"><span class="pre">django.test._doctest</span></code> is removed.</li>
<li>The <code class="docutils literal"><span class="pre">CACHE_MIDDLEWARE_ANONYMOUS_ONLY</span></code> setting is removed. This change
affects both <code class="docutils literal"><span class="pre">django.middleware.cache.CacheMiddleware</span></code> and
<code class="docutils literal"><span class="pre">django.middleware.cache.UpdateCacheMiddleware</span></code> despite the lack of a
deprecation warning in the latter class.</li>
<li>Usage of the hard-coded <em>Hold down &#8220;Control&#8221;, or &#8220;Command&#8221; on a Mac, to select
more than one.</em> string to override or append to user-provided <code class="docutils literal"><span class="pre">help_text</span></code> in
forms for <code class="docutils literal"><span class="pre">ManyToMany</span></code> model fields is not performed by Django anymore
either at the model or forms layer.</li>
<li>The <code class="docutils literal"><span class="pre">Model._meta.get_(add|change|delete)_permission</span></code> methods are removed.</li>
<li>The session key <code class="docutils literal"><span class="pre">django_language</span></code> is no longer read for backwards
compatibility.</li>
<li>Geographic Sitemaps are removed
(<code class="docutils literal"><span class="pre">django.contrib.gis.sitemaps.views.index</span></code> and
<code class="docutils literal"><span class="pre">django.contrib.gis.sitemaps.views.sitemap</span></code>).</li>
<li><code class="docutils literal"><span class="pre">django.utils.html.fix_ampersands</span></code>, the <code class="docutils literal"><span class="pre">fix_ampersands</span></code> template filter,
and <code class="docutils literal"><span class="pre">django.utils.html.clean_html</span></code> are removed.</li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Django 1.8 release notes</a><ul>
<li><a class="reference internal" href="#python-compatibility">Python compatibility</a></li>
<li><a class="reference internal" href="#what-s-new-in-django-1-8">What&#8217;s new in Django 1.8</a><ul>
<li><a class="reference internal" href="#model-meta-api"><code class="docutils literal"><span class="pre">Model._meta</span></code> API</a></li>
<li><a class="reference internal" href="#multiple-template-engines">Multiple template engines</a></li>
<li><a class="reference internal" href="#security-enhancements">Security enhancements</a></li>
<li><a class="reference internal" href="#new-postgresql-specific-functionality">New PostgreSQL specific functionality</a></li>
<li><a class="reference internal" href="#new-data-types">New data types</a></li>
<li><a class="reference internal" href="#query-expressions-conditional-expressions-and-database-functions">Query Expressions, Conditional Expressions, and Database Functions</a></li>
<li><a class="reference internal" href="#testcase-data-setup"><code class="docutils literal"><span class="pre">TestCase</span></code> data setup</a></li>
<li><a class="reference internal" href="#minor-features">Minor features</a><ul>
<li><a class="reference internal" href="#django-contrib-admin"><code class="docutils literal"><span class="pre">django.contrib.admin</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-admindocs"><code class="docutils literal"><span class="pre">django.contrib.admindocs</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-auth"><code class="docutils literal"><span class="pre">django.contrib.auth</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-gis"><code class="docutils literal"><span class="pre">django.contrib.gis</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-sessions"><code class="docutils literal"><span class="pre">django.contrib.sessions</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-sitemaps"><code class="docutils literal"><span class="pre">django.contrib.sitemaps</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-sites"><code class="docutils literal"><span class="pre">django.contrib.sites</span></code></a></li>
<li><a class="reference internal" href="#cache">Cache</a></li>
<li><a class="reference internal" href="#cryptography">Cryptography</a></li>
<li><a class="reference internal" href="#database-backends">Database backends</a></li>
<li><a class="reference internal" href="#email">Email</a></li>
<li><a class="reference internal" href="#file-storage">File Storage</a></li>
<li><a class="reference internal" href="#forms">Forms</a></li>
<li><a class="reference internal" href="#generic-views">Generic Views</a></li>
<li><a class="reference internal" href="#internationalization">Internationalization</a></li>
<li><a class="reference internal" href="#logging">Logging</a></li>
<li><a class="reference internal" href="#management-commands">Management Commands</a></li>
<li><a class="reference internal" href="#middleware">Middleware</a></li>
<li><a class="reference internal" href="#migrations">Migrations</a></li>
<li><a class="reference internal" href="#models">Models</a></li>
<li><a class="reference internal" href="#signals">Signals</a></li>
<li><a class="reference internal" href="#system-check-framework">System Check Framework</a></li>
<li><a class="reference internal" href="#templates">Templates</a></li>
<li><a class="reference internal" href="#requests-and-responses">Requests and Responses</a></li>
<li><a class="reference internal" href="#tests">Tests</a></li>
<li><a class="reference internal" href="#validators">Validators</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#backwards-incompatible-changes-in-1-8">Backwards incompatible changes in 1.8</a><ul>
<li><a class="reference internal" href="#related-object-operations-are-run-in-a-transaction">Related object operations are run in a transaction</a></li>
<li><a class="reference internal" href="#assigning-unsaved-objects-to-relations-raises-an-error">Assigning unsaved objects to relations raises an error</a></li>
<li><a class="reference internal" href="#management-commands-that-only-accept-positional-arguments">Management commands that only accept positional arguments</a></li>
<li><a class="reference internal" href="#custom-test-management-command-arguments-through-test-runner">Custom test management command arguments through test runner</a></li>
<li><a class="reference internal" href="#model-check-ensures-auto-generated-column-names-are-within-limits-specified-by-database">Model check ensures auto-generated column names are within limits specified by database</a></li>
<li><a class="reference internal" href="#query-relation-lookups-now-check-object-types">Query relation lookups now check object types</a></li>
<li><a class="reference internal" href="#select-related-now-checks-given-fields"><code class="docutils literal"><span class="pre">select_related()</span></code> now checks given fields</a></li>
<li><a class="reference internal" href="#default-emailfield-max-length-increased-to-254">Default <code class="docutils literal"><span class="pre">EmailField.max_length</span></code> increased to 254</a></li>
<li><a class="reference internal" href="#support-for-postgresql-versions-older-than-9-0">Support for PostgreSQL versions older than 9.0</a></li>
<li><a class="reference internal" href="#support-for-mysql-versions-older-than-5-5">Support for MySQL versions older than 5.5</a></li>
<li><a class="reference internal" href="#support-for-oracle-versions-older-than-11-1">Support for Oracle versions older than 11.1</a></li>
<li><a class="reference internal" href="#specific-privileges-used-instead-of-roles-for-tests-on-oracle">Specific privileges used instead of roles for tests on Oracle</a></li>
<li><a class="reference internal" href="#abstractuser-last-login-allows-null-values"><code class="docutils literal"><span class="pre">AbstractUser.last_login</span></code> allows null values</a></li>
<li><a class="reference internal" href="#id1"><code class="docutils literal"><span class="pre">django.contrib.gis</span></code></a></li>
<li><a class="reference internal" href="#priority-of-context-processors-for-templateresponse-brought-in-line-with-render">Priority of context processors for <code class="docutils literal"><span class="pre">TemplateResponse</span></code> brought in line with <code class="docutils literal"><span class="pre">render</span></code></a></li>
<li><a class="reference internal" href="#overriding-setupclass-teardownclass-in-test-cases">Overriding <code class="docutils literal"><span class="pre">setUpClass</span></code> / <code class="docutils literal"><span class="pre">tearDownClass</span></code> in test cases</a></li>
<li><a class="reference internal" href="#removal-of-django-contrib-formtools">Removal of <code class="docutils literal"><span class="pre">django.contrib.formtools</span></code></a></li>
<li><a class="reference internal" href="#database-connection-reloading-between-tests">Database connection reloading between tests</a></li>
<li><a class="reference internal" href="#cleanup-of-the-django-template-namespace">Cleanup of the <code class="docutils literal"><span class="pre">django.template</span></code> namespace</a></li>
<li><a class="reference internal" href="#model-attribute-on-private-model-relations"><code class="docutils literal"><span class="pre">model</span></code> attribute on private model relations</a></li>
<li><a class="reference internal" href="#database-backend-api">Database backend API</a></li>
<li><a class="reference internal" href="#id2"><code class="docutils literal"><span class="pre">django.contrib.admin</span></code></a></li>
<li><a class="reference internal" href="#default-autoescaping-of-functions-in-django-template-defaultfilters">Default autoescaping of functions in <code class="docutils literal"><span class="pre">django.template.defaultfilters</span></code></a></li>
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
</ul>
</li>
<li><a class="reference internal" href="#features-deprecated-in-1-8">Features deprecated in 1.8</a><ul>
<li><a class="reference internal" href="#selected-methods-in-django-db-models-options-options">Selected methods in <code class="docutils literal"><span class="pre">django.db.models.options.Options</span></code></a></li>
<li><a class="reference internal" href="#loading-cycle-and-firstof-template-tags-from-future-library">Loading <code class="docutils literal"><span class="pre">cycle</span></code> and <code class="docutils literal"><span class="pre">firstof</span></code> template tags from <code class="docutils literal"><span class="pre">future</span></code> library</a></li>
<li><a class="reference internal" href="#django-conf-urls-patterns"><code class="docutils literal"><span class="pre">django.conf.urls.patterns()</span></code></a></li>
<li><a class="reference internal" href="#passing-a-string-as-view-to-url">Passing a string as <code class="docutils literal"><span class="pre">view</span></code> to <code class="docutils literal"><span class="pre">url()</span></code></a></li>
<li><a class="reference internal" href="#template-related-settings">Template-related settings</a></li>
<li><a class="reference internal" href="#django-core-context-processors"><code class="docutils literal"><span class="pre">django.core.context_processors</span></code></a></li>
<li><a class="reference internal" href="#django-test-simpletestcase-urls"><code class="docutils literal"><span class="pre">django.test.SimpleTestCase.urls</span></code></a></li>
<li><a class="reference internal" href="#prefix-argument-to-i18n-patterns"><code class="docutils literal"><span class="pre">prefix</span></code> argument to <code class="docutils literal"><span class="pre">i18n_patterns()</span></code></a></li>
<li><a class="reference internal" href="#using-an-incorrect-count-of-unpacked-values-in-the-for-template-tag">Using an incorrect count of unpacked values in the <code class="docutils literal"><span class="pre">for</span></code> template tag</a></li>
<li><a class="reference internal" href="#passing-a-dotted-path-to-reverse-and-url">Passing a dotted path to <code class="docutils literal"><span class="pre">reverse()</span></code> and <code class="docutils literal"><span class="pre">url</span></code></a></li>
<li><a class="reference internal" href="#aggregate-methods-and-modules">Aggregate methods and modules</a></li>
<li><a class="reference internal" href="#extending-management-command-arguments-through-command-option-list">Extending management command arguments through <code class="docutils literal"><span class="pre">Command.option_list</span></code></a></li>
<li><a class="reference internal" href="#django-core-management-noargscommand"><code class="docutils literal"><span class="pre">django.core.management.NoArgsCommand</span></code></a></li>
<li><a class="reference internal" href="#listing-all-migrations-in-a-project">Listing all migrations in a project</a></li>
<li><a class="reference internal" href="#cache-choices-option-of-modelchoicefield-and-modelmultiplechoicefield"><code class="docutils literal"><span class="pre">cache_choices</span></code> option of <code class="docutils literal"><span class="pre">ModelChoiceField</span></code> and <code class="docutils literal"><span class="pre">ModelMultipleChoiceField</span></code></a></li>
<li><a class="reference internal" href="#django-template-resolve-variable"><code class="docutils literal"><span class="pre">django.template.resolve_variable()</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-webdesign"><code class="docutils literal"><span class="pre">django.contrib.webdesign</span></code></a></li>
<li><a class="reference internal" href="#error-message-argument-to-django-forms-regexfield"><code class="docutils literal"><span class="pre">error_message</span></code> argument to <code class="docutils literal"><span class="pre">django.forms.RegexField</span></code></a></li>
<li><a class="reference internal" href="#old-unordered-list-syntax">Old <code class="docutils literal"><span class="pre">unordered_list</span></code> syntax</a></li>
<li><a class="reference internal" href="#django-forms-field-has-changed"><code class="docutils literal"><span class="pre">django.forms.Field._has_changed()</span></code></a></li>
<li><a class="reference internal" href="#django-utils-html-remove-tags-and-removetags-template-filter"><code class="docutils literal"><span class="pre">django.utils.html.remove_tags()</span></code> and <code class="docutils literal"><span class="pre">removetags</span></code> template filter</a></li>
<li><a class="reference internal" href="#is-admin-site-argument-to-django-contrib-auth-views-password-reset"><code class="docutils literal"><span class="pre">is_admin_site</span></code> argument to <code class="docutils literal"><span class="pre">django.contrib.auth.views.password_reset()</span></code></a></li>
<li><a class="reference internal" href="#subfieldbase"><code class="docutils literal"><span class="pre">SubfieldBase</span></code></a></li>
<li><a class="reference internal" href="#django-utils-checksums"><code class="docutils literal"><span class="pre">django.utils.checksums</span></code></a></li>
<li><a class="reference internal" href="#inlineadminform-original-content-type-id"><code class="docutils literal"><span class="pre">InlineAdminForm.original_content_type_id</span></code></a></li>
<li><a class="reference internal" href="#django-views-generic-edit-formmixin-get-form-s-form-class-argument"><code class="docutils literal"><span class="pre">django.views.generic.edit.FormMixin.get_form()</span></code>’s <code class="docutils literal"><span class="pre">form_class</span></code> argument</a></li>
<li><a class="reference internal" href="#rendering-templates-loaded-by-get-template-with-a-context">Rendering templates loaded by <code class="docutils literal"><span class="pre">get_template()</span></code> with a <code class="docutils literal"><span class="pre">Context</span></code></a></li>
<li><a class="reference internal" href="#template-and-context-classes-in-template-responses"><code class="docutils literal"><span class="pre">Template</span></code> and <code class="docutils literal"><span class="pre">Context</span></code> classes in template responses</a></li>
<li><a class="reference internal" href="#current-app-argument-of-template-related-apis"><code class="docutils literal"><span class="pre">current_app</span></code> argument of template-related APIs</a></li>
<li><a class="reference internal" href="#dictionary-and-context-instance-arguments-of-rendering-functions"><code class="docutils literal"><span class="pre">dictionary</span></code> and <code class="docutils literal"><span class="pre">context_instance</span></code> arguments of rendering functions</a></li>
<li><a class="reference internal" href="#dirs-argument-of-template-finding-functions"><code class="docutils literal"><span class="pre">dirs</span></code> argument of template-finding functions</a></li>
<li><a class="reference internal" href="#django-template-loader-baseloader"><code class="docutils literal"><span class="pre">django.template.loader.BaseLoader</span></code></a></li>
<li><a class="reference internal" href="#django-test-utils-testtemplateloader"><code class="docutils literal"><span class="pre">django.test.utils.TestTemplateLoader</span></code></a></li>
<li><a class="reference internal" href="#support-for-the-max-length-argument-on-custom-storage-classes">Support for the <code class="docutils literal"><span class="pre">max_length</span></code> argument on custom <code class="docutils literal"><span class="pre">Storage</span></code> classes</a></li>
<li><a class="reference internal" href="#qn-replaced-by-compiler"><code class="docutils literal"><span class="pre">qn</span></code> replaced by <code class="docutils literal"><span class="pre">compiler</span></code></a></li>
<li><a class="reference internal" href="#default-value-of-redirectview-permanent">Default value of <code class="docutils literal"><span class="pre">RedirectView.permanent</span></code></a></li>
<li><a class="reference internal" href="#using-authenticationmiddleware-without-sessionauthenticationmiddleware">Using <code class="docutils literal"><span class="pre">AuthenticationMiddleware</span></code> without <code class="docutils literal"><span class="pre">SessionAuthenticationMiddleware</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-sitemaps-flatpagesitemap"><code class="docutils literal"><span class="pre">django.contrib.sitemaps.FlatPageSitemap</span></code></a></li>
<li><a class="reference internal" href="#model-field-related">Model <code class="docutils literal"><span class="pre">Field.related</span></code></a></li>
<li><a class="reference internal" href="#ssi-template-tag"><code class="docutils literal"><span class="pre">ssi</span></code> template tag</a></li>
<li><a class="reference internal" href="#as-comparison-operator-in-if-template-tag"><code class="docutils literal"><span class="pre">=</span></code> as comparison operator in <code class="docutils literal"><span class="pre">if</span></code> template tag</a></li>
<li><a class="reference internal" href="#foo-s-syntax-in-modelformmixin-success-url"><code class="docutils literal"><span class="pre">%(&lt;foo&gt;)s</span></code> syntax in <code class="docutils literal"><span class="pre">ModelFormMixin.success_url</span></code></a></li>
<li><a class="reference internal" href="#geoqueryset-aggregate-methods"><code class="docutils literal"><span class="pre">GeoQuerySet</span></code> aggregate methods</a></li>
<li><a class="reference internal" href="#signature-of-the-allow-migrate-router-method">Signature of the <code class="docutils literal"><span class="pre">allow_migrate</span></code> router method</a></li>
</ul>
</li>
<li><a class="reference internal" href="#features-removed-in-1-8">Features removed in 1.8</a></li>
</ul>
</li>
</ul>

  <h3>Browse</h3>
  <ul>
    
      <li>Prev: <a href="1.8.1.html">Django 1.8.1 release notes</a></li>
    
    
      <li>Next: <a href="1.7.11.html">Django 1.7.11 release notes</a></li>
    
  </ul>
  <h3>You are here:</h3>
  <ul>
      <li>
        <a href="../index.html">Django 1.8.19 documentation</a>
        
          <ul><li><a href="index.html">Release notes</a>
        
        <ul><li>Django 1.8 release notes</li></ul>
        </li></ul>
      </li>
  </ul>

  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/releases/1.8.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Jan 06, 2019</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="1.8.1.html" title="Django 1.8.1 release notes">previous</a>
     |
    <a href="index.html" title="Release notes" accesskey="U">up</a>
   |
    <a href="1.7.11.html" title="Django 1.7.11 release notes">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>