{"title":"Django 1.5 release notes","version":"dev","locale":"en","docname":"releases/1.5","url":"/en/dev/releases/1.5/","canonical":"https://djangodocs.dev/en/dev/releases/1.5/","summary":"Welcome to Django 1.5! These release notes cover the new features, as well as some backwards incompatible changes you’ll want to be aware of when upgrading…","html":"<h1>Django 1.5 release notes<a class=\"heading-anchor\" href=\"#django-1-5-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>February 26, 2013</em></p>\n<p>Welcome to Django 1.5!</p>\n<p>These release notes cover the <a class=\"reference internal\" href=\"#whats-new-1-5\"><span class=\"std std-ref\">new features</span></a>, as well as\nsome <a class=\"reference internal\" href=\"#backwards-incompatible-1-5\"><span class=\"std std-ref\">backwards incompatible changes</span></a> you’ll\nwant to be aware of when upgrading from Django 1.4 or older versions. We’ve\nalso dropped some features, which are detailed in <a class=\"reference internal\" href=\"/en/dev/internals/deprecation/#deprecation-removed-in-1-5\"><span class=\"std std-ref\">our deprecation plan</span></a>, and we’ve <a class=\"reference internal\" href=\"#deprecated-features-1-5\"><span class=\"std std-ref\">begun the deprecation process\nfor some features</span></a>.</p>\n<section id=\"overview\">\n<h2>Overview<a class=\"heading-anchor\" href=\"#overview\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>The biggest new feature in Django 1.5 is the <a class=\"reference internal\" href=\"#configurable-user-model\">configurable User model</a>. Before\nDjango 1.5, applications that wanted to use Django’s auth framework\n(<a class=\"reference internal\" href=\"/en/dev/topics/auth/#module-django.contrib.auth\" title=\"django.contrib.auth: Django's authentication framework.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.auth</code></a>) were forced to use Django’s definition of a\n“user”. In Django 1.5, you can now swap out the <code class=\"docutils literal notranslate\">User</code> model for one that you\nwrite yourself. This could be a simple extension to the existing <code class=\"docutils literal notranslate\">User</code> model\n– for example, you could add a Twitter or Facebook ID field – or you could\ncompletely replace the <code class=\"docutils literal notranslate\">User</code> with one totally customized for your site.</p>\n<p>Django 1.5 is also the first release with <a class=\"reference internal\" href=\"#python-3-support\">Python 3 support</a>! We’re labeling\nthis support “experimental” because we don’t yet consider it production-ready,\nbut everything’s in place for you to start porting your apps to Python 3.\nOur next release, Django 1.6, will support Python 3 without reservations.</p>\n<p>Other notable new features in Django 1.5 include:</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"#support-for-saving-a-subset-of-model-s-fields\">Support for saving a subset of model’s fields</a> -\n<a class=\"reference internal\" href=\"/en/dev/ref/models/instances/#django.db.models.Model.save\" title=\"django.db.models.Model.save\"><code class=\"xref py py-meth docutils literal notranslate\">Model.save()</code></a> now accepts an\n<code class=\"docutils literal notranslate\">update_fields</code> argument, letting you specify which fields are\nwritten back to the database when you call <code class=\"docutils literal notranslate\">save()</code>. This can help\nin high-concurrency operations, and can improve performance.</p></li>\n<li><p>Better <a class=\"reference external\" href=\"#explicit-streaming-responses\">support for streaming responses</a> via\nthe new  <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.StreamingHttpResponse\" title=\"django.http.StreamingHttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">StreamingHttpResponse</code></a> response class.</p></li>\n<li><p><a class=\"reference internal\" href=\"#geodjango\">GeoDjango</a> now supports PostGIS 2.0.</p></li>\n<li><p>… and more; <a class=\"reference external\" href=\"#what-s-new-in-django-1-5\">see below</a>.</p></li>\n</ul>\n<p>Wherever possible we try to introduce new features in a backwards-compatible\nmanner per <a class=\"reference internal\" href=\"/en/dev/misc/api-stability/\"><span class=\"doc\">our API stability policy</span></a>.\nHowever, as with previous releases, Django 1.5 ships with some minor\n<a class=\"reference internal\" href=\"#backwards-incompatible-1-5\"><span class=\"std std-ref\">backwards incompatible changes</span></a>; people\nupgrading from previous versions of Django should read that list carefully.</p>\n<p>One deprecated feature worth noting is the shift to “new-style” <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-url\"><code class=\"xref std std-ttag docutils literal notranslate\">url</code></a>\ntag. Prior to Django 1.3, syntax like <code class=\"docutils literal notranslate\">{% url myview %}</code> was interpreted\nincorrectly (Django considered <code class=\"docutils literal notranslate\">&quot;myview&quot;</code> to be a literal name of a view, not\na template variable named <code class=\"docutils literal notranslate\">myview</code>). Django 1.3 and above introduced the <code class=\"docutils literal notranslate\">{%\nload url from future %}</code> syntax to bring in the corrected behavior where\n<code class=\"docutils literal notranslate\">myview</code> was seen as a variable.</p>\n<p>The upshot of this is that if you are not using <code class=\"docutils literal notranslate\">{% load url from future %}</code>\nin your templates, you’ll need to change tags like <code class=\"docutils literal notranslate\">{% url myview %}</code> to\n<code class=\"docutils literal notranslate\">{% url &quot;myview&quot; %}</code>. If you <em>were</em> using <code class=\"docutils literal notranslate\">{% load url from future %}</code> you\ncan simply remove that line under Django 1.5</p>\n</section>\n<section id=\"python-compatibility\">\n<h2>Python compatibility<a class=\"heading-anchor\" href=\"#python-compatibility\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django 1.5 requires Python 2.6.5 or above, though we <strong>highly recommend</strong>\nPython 2.7.3 or above. Support for Python 2.5 and below has been dropped.</p>\n<p>This change should affect only a small number of Django users, as most\noperating-system vendors today are shipping Python 2.6 or newer as their\ndefault version. If you’re still using Python 2.5, however, you’ll need to\nstick to Django 1.4 until you can upgrade your Python version. Per <a class=\"reference internal\" href=\"/en/dev/internals/release-process/\"><span class=\"doc\">our\nsupport policy</span></a>, Django 1.4 will continue to\nreceive security support until the release of Django 1.6.</p>\n<p>Django 1.5 does not run on a Jython final release, because Jython’s latest\nrelease doesn’t currently support Python 2.6. However, Jython currently does\noffer an alpha release featuring 2.7 support, and Django 1.5 supports that\nalpha release.</p>\n<section id=\"python-3-support\">\n<h3>Python 3 support<a class=\"heading-anchor\" href=\"#python-3-support\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.5 introduces support for Python 3 - specifically, Python\n3.2 and above. This comes in the form of a <strong>single</strong> codebase; you don’t\nneed to install a different version of Django on Python 3. This means that\nyou can write applications targeted for just Python 2, just Python 3, or single\napplications that support both platforms.</p>\n<p>However, we’re labeling this support “experimental” for now: although it’s\nreceived extensive testing via our automated test suite, it’s received very\nlittle real-world testing. We’ve done our best to eliminate bugs, but we can’t\nbe sure we covered all possible uses of Django.</p>\n<p>Some features of Django aren’t available because they depend on third-party\nsoftware that hasn’t been ported to Python 3 yet, including:</p>\n<ul class=\"simple\">\n<li><p>the MySQL database backend (depends on MySQLdb)</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ImageField\" title=\"django.db.models.ImageField\"><code class=\"xref py py-class docutils literal notranslate\">ImageField</code></a> (depends on PIL)</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.LiveServerTestCase\" title=\"django.test.LiveServerTestCase\"><code class=\"xref py py-class docutils literal notranslate\">LiveServerTestCase</code></a> (depends on Selenium WebDriver)</p></li>\n</ul>\n<p>Further, Django’s more than a web framework; it’s an ecosystem of pluggable\ncomponents. At this point, very few third-party applications have been ported\nto Python 3, so it’s unlikely that a real-world application will have all its\ndependencies satisfied under Python 3.</p>\n<p>Thus, we’re recommending that Django 1.5 not be used in production under Python\n3. Instead, use this opportunity to begin porting applications to Python 3. If\nyou’re an author of a pluggable component, we encourage you to start porting\nnow.</p>\n<p>We plan to offer first-class, production-ready support for Python 3 in our next\nrelease, Django 1.6.</p>\n</section>\n</section>\n<section id=\"what-s-new-in-django-1-5\">\n<span id=\"whats-new-1-5\"></span><h2>What’s new in Django 1.5<a class=\"heading-anchor\" href=\"#what-s-new-in-django-1-5\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"configurable-user-model\">\n<h3>Configurable User model<a class=\"heading-anchor\" href=\"#configurable-user-model\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In Django 1.5, you can now use your own model as the store for user-related\ndata. If your project needs a username with more than 30 characters, or if\nyou want to store user’s names in a format other than first name/last name,\nor you want to put custom profile information onto your User object, you can\nnow do so.</p>\n<p>If you have a third-party reusable application that references the User model,\nyou may need to make some changes to the way you reference User instances. You\nshould also document any specific features of the User model that your\napplication relies upon.</p>\n<p>See the <a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#auth-custom-user\"><span class=\"std std-ref\">documentation on custom user models</span></a> for\nmore details.</p>\n</section>\n<section id=\"support-for-saving-a-subset-of-model-s-fields\">\n<h3>Support for saving a subset of model’s fields<a class=\"heading-anchor\" href=\"#support-for-saving-a-subset-of-model-s-fields\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The method <a class=\"reference internal\" href=\"/en/dev/ref/models/instances/#django.db.models.Model.save\" title=\"django.db.models.Model.save\"><code class=\"xref py py-meth docutils literal notranslate\">Model.save()</code></a> has a new\nkeyword argument <code class=\"docutils literal notranslate\">update_fields</code>. By using this argument it is possible to\nsave only a select list of model’s fields. This can be useful for performance\nreasons or when trying to avoid overwriting concurrent changes.</p>\n<p>Deferred instances (those loaded by <code class=\"docutils literal notranslate\">.only()</code> or <code class=\"docutils literal notranslate\">.defer()</code>) will\nautomatically save just the loaded fields. If any field is set manually after\nload, that field will also get updated on save.</p>\n<p>See the <a class=\"reference internal\" href=\"/en/dev/ref/models/instances/#django.db.models.Model.save\" title=\"django.db.models.Model.save\"><code class=\"xref py py-meth docutils literal notranslate\">Model.save()</code></a> documentation for\nmore details.</p>\n</section>\n<section id=\"caching-of-related-model-instances\">\n<h3>Caching of related model instances<a class=\"heading-anchor\" href=\"#caching-of-related-model-instances\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>When traversing relations, the ORM will avoid re-fetching objects that were\npreviously loaded. For example, with the tutorial’s models:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>first_poll <span class=\"o\">=</span> Poll<span class=\"o\">.</span>objects<span class=\"o\">.</span>all<span class=\"p\">()[</span><span class=\"mi\">0</span><span class=\"p\">]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>first_choice <span class=\"o\">=</span> first_poll<span class=\"o\">.</span>choice_set<span class=\"o\">.</span>all<span class=\"p\">()[</span><span class=\"mi\">0</span><span class=\"p\">]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>first_choice<span class=\"o\">.</span>poll <span class=\"ow\">is</span> first_poll\n<span class=\"go\">True</span>\n</code></pre></div>\n<p>In Django 1.5, the third line no longer triggers a new SQL query to fetch\n<code class=\"docutils literal notranslate\">first_choice.poll</code>; it was set by the second line.</p>\n<p>For one-to-one relationships, both sides can be cached. For many-to-one\nrelationships, only the single side of the relationship can be cached. This\nis particularly helpful in combination with <code class=\"docutils literal notranslate\">prefetch_related</code>.</p>\n</section>\n<section id=\"explicit-support-for-streaming-responses\">\n<span id=\"explicit-streaming-responses\"></span><h3>Explicit support for streaming responses<a class=\"heading-anchor\" href=\"#explicit-support-for-streaming-responses\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Before Django 1.5, it was possible to create a streaming response by passing\nan iterator to <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a>. But this was unreliable:\nany middleware that accessed the <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse.content\" title=\"django.http.HttpResponse.content\"><code class=\"xref py py-attr docutils literal notranslate\">content</code></a>\nattribute would consume the iterator prematurely.</p>\n<p>You can now explicitly generate a streaming response with the new\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.StreamingHttpResponse\" title=\"django.http.StreamingHttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">StreamingHttpResponse</code></a> class. This class exposes a\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.StreamingHttpResponse.streaming_content\" title=\"django.http.StreamingHttpResponse.streaming_content\"><code class=\"xref py py-class docutils literal notranslate\">streaming_content</code></a> attribute which\nis an iterator.</p>\n<p>Since <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.StreamingHttpResponse\" title=\"django.http.StreamingHttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">StreamingHttpResponse</code></a> does not have a <code class=\"docutils literal notranslate\">content</code>\nattribute, middleware that needs access to the response content must test for\nstreaming responses and behave accordingly.</p>\n</section>\n<section id=\"verbatim-template-tag\">\n<h3><code class=\"docutils literal notranslate\">{% verbatim %}</code> template tag<a class=\"heading-anchor\" href=\"#verbatim-template-tag\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>To make it easier to deal with JavaScript templates which collide with Django’s\nsyntax, you can now use the <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-verbatim\"><code class=\"xref std std-ttag docutils literal notranslate\">verbatim</code></a> block tag to avoid parsing the\ntag’s content.</p>\n</section>\n<section id=\"retrieval-of-contenttype-instances-associated-with-proxy-models\">\n<h3>Retrieval of <code class=\"docutils literal notranslate\">ContentType</code> instances associated with proxy models<a class=\"heading-anchor\" href=\"#retrieval-of-contenttype-instances-associated-with-proxy-models\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The methods <a class=\"reference internal\" href=\"/en/dev/ref/contrib/contenttypes/#django.contrib.contenttypes.models.ContentTypeManager.get_for_model\" title=\"django.contrib.contenttypes.models.ContentTypeManager.get_for_model\"><code class=\"xref py py-meth docutils literal notranslate\">ContentTypeManager.get_for_model()</code></a>\nand <a class=\"reference internal\" href=\"/en/dev/ref/contrib/contenttypes/#django.contrib.contenttypes.models.ContentTypeManager.get_for_models\" title=\"django.contrib.contenttypes.models.ContentTypeManager.get_for_models\"><code class=\"xref py py-meth docutils literal notranslate\">ContentTypeManager.get_for_models()</code></a>\nhave a new keyword argument – respectively <code class=\"docutils literal notranslate\">for_concrete_model</code> and\n<code class=\"docutils literal notranslate\">for_concrete_models</code>. By passing <code class=\"docutils literal notranslate\">False</code> using this argument it is now\npossible to retrieve the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/contenttypes/#django.contrib.contenttypes.models.ContentType\" title=\"django.contrib.contenttypes.models.ContentType\"><code class=\"xref py py-class docutils literal notranslate\">ContentType</code></a> associated with proxy models.</p>\n</section>\n<section id=\"new-view-variable-in-class-based-views-context\">\n<h3>New <code class=\"docutils literal notranslate\">view</code> variable in class-based views context<a class=\"heading-anchor\" href=\"#new-view-variable-in-class-based-views-context\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In all <a class=\"reference internal\" href=\"/en/dev/topics/class-based-views/\"><span class=\"doc\">generic class-based views</span></a>\n(or any class-based view inheriting from <code class=\"docutils literal notranslate\">ContextMixin</code>), the context\ndictionary contains a <code class=\"docutils literal notranslate\">view</code> variable that points to the <code class=\"docutils literal notranslate\">View</code> instance.</p>\n</section>\n<section id=\"geodjango\">\n<h3>GeoDjango<a class=\"heading-anchor\" href=\"#geodjango\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.LineString\" title=\"django.contrib.gis.geos.LineString\"><code class=\"xref py py-class docutils literal notranslate\">LineString</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.MultiLineString\" title=\"django.contrib.gis.geos.MultiLineString\"><code class=\"xref py py-class docutils literal notranslate\">MultiLineString</code></a> GEOS objects now support\nthe <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.interpolate\" title=\"django.contrib.gis.geos.GEOSGeometry.interpolate\"><code class=\"xref py py-meth docutils literal notranslate\">interpolate()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.project\" title=\"django.contrib.gis.geos.GEOSGeometry.project\"><code class=\"xref py py-meth docutils literal notranslate\">project()</code></a> methods (so-called\nlinear referencing).</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">wkb</code> and <code class=\"docutils literal notranslate\">hex</code> properties of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry\" title=\"django.contrib.gis.geos.GEOSGeometry\"><code class=\"xref py py-class docutils literal notranslate\">GEOSGeometry</code></a> objects preserve the Z\ndimension.</p></li>\n<li><p>Support for PostGIS 2.0 has been added and support for GDAL &lt; 1.5 has been\ndropped.</p></li>\n</ul>\n</section>\n<section id=\"new-tutorials\">\n<h3>New tutorials<a class=\"heading-anchor\" href=\"#new-tutorials\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Additions to the docs include a revamped <a class=\"reference internal\" href=\"/en/dev/intro/tutorial03/\"><span class=\"doc\">Tutorial 3</span></a>\nand a new <a class=\"reference internal\" href=\"/en/dev/intro/tutorial05/\"><span class=\"doc\">tutorial on testing</span></a>. A new section,\n“Advanced Tutorials”, offers <a class=\"reference internal\" href=\"/en/dev/intro/reusable-apps/\"><span class=\"doc\">How to write reusable apps</span></a> as well as a step-by-step guide for new contributors in\n<a class=\"reference internal\" href=\"/en/dev/intro/contributing/\"><span class=\"doc\">Writing your first patch for Django</span></a>.</p>\n</section>\n<section id=\"minor-features\">\n<h3>Minor features<a class=\"heading-anchor\" href=\"#minor-features\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.5 also includes several smaller improvements worth noting:</p>\n<ul>\n<li><p>The template engine now interprets <code class=\"docutils literal notranslate\">True</code>, <code class=\"docutils literal notranslate\">False</code> and <code class=\"docutils literal notranslate\">None</code> as the\ncorresponding Python objects.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/utils/#module-django.utils.timezone\" title=\"django.utils.timezone: Timezone support.\"><code class=\"xref py py-mod docutils literal notranslate\">django.utils.timezone</code></a> provides a helper for converting aware\ndatetimes between time zones. See <a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.timezone.localtime\" title=\"django.utils.timezone.localtime\"><code class=\"xref py py-func docutils literal notranslate\">localtime()</code></a>.</p></li>\n<li><p>The generic views support OPTIONS requests.</p></li>\n<li><p>Management commands do not raise <code class=\"docutils literal notranslate\">SystemExit</code> any more when called by code\nfrom <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django.core.management.call_command\" title=\"django.core.management.call_command\"><code class=\"xref py py-func docutils literal notranslate\">call_command()</code></a>. Any exception raised by\nthe command (mostly <a class=\"reference internal\" href=\"/en/dev/howto/custom-management-commands/#django.core.management.CommandError\" title=\"django.core.management.CommandError\"><code class=\"xref py py-exc docutils literal notranslate\">CommandError</code></a>) is\npropagated.</p>\n<p>Moreover, when you output errors or messages in your custom commands, you\nshould now use <code class=\"docutils literal notranslate\">self.stdout.write('message')</code> and\n<code class=\"docutils literal notranslate\">self.stderr.write('error')</code> (see the note on\n<a class=\"reference internal\" href=\"/en/dev/howto/custom-management-commands/#management-commands-output\"><span class=\"std std-ref\">management commands output</span></a>).</p>\n</li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-dumpdata\"><code class=\"xref std std-djadmin docutils literal notranslate\">dumpdata</code></a> management command outputs one row at a time,\npreventing out-of-memory errors when dumping large datasets.</p></li>\n<li><p>In the localflavor for Canada, <code class=\"docutils literal notranslate\">pq</code> was added to the acceptable codes for\nQuebec. It’s an old abbreviation.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/signals/#connecting-receiver-functions\"><span class=\"std std-ref\">receiver</span></a> decorator is now able to\nconnect to more than one signal by supplying a list of signals.</p></li>\n<li><p>In the admin, you can now filter users by groups which they are members of.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.bulk_create\" title=\"django.db.models.query.QuerySet.bulk_create\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.bulk_create()</code></a> now has a batch_size\nargument. By default the batch_size is unlimited except for SQLite where\nsingle batch is limited so that 999 parameters per query isn’t exceeded.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOGIN_URL\"><code class=\"xref std std-setting docutils literal notranslate\">LOGIN_URL</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOGIN_REDIRECT_URL\"><code class=\"xref std std-setting docutils literal notranslate\">LOGIN_REDIRECT_URL</code></a> settings now also\naccept view function names and\n<a class=\"reference internal\" href=\"/en/dev/topics/http/urls/#naming-url-patterns\"><span class=\"std std-ref\">named URL patterns</span></a>. This allows you to reduce\nconfiguration duplication. More information can be found in the\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.decorators.login_required\" title=\"django.contrib.auth.decorators.login_required\"><code class=\"xref py py-func docutils literal notranslate\">login_required()</code></a> documentation.</p></li>\n<li><p>Django now provides a mod_wsgi <a class=\"reference internal\" href=\"/en/dev/howto/deployment/wsgi/apache-auth/\"><span class=\"doc\">auth handler</span></a>.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.delete\" title=\"django.db.models.query.QuerySet.delete\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.delete()</code></a>\nand <a class=\"reference internal\" href=\"/en/dev/ref/models/instances/#django.db.models.Model.delete\" title=\"django.db.models.Model.delete\"><code class=\"xref py py-meth docutils literal notranslate\">Model.delete()</code></a> can now take\nfast-path in some cases. The fast-path allows for less queries and less\nobjects fetched into memory. See <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.delete\" title=\"django.db.models.query.QuerySet.delete\"><code class=\"xref py py-meth docutils literal notranslate\">QuerySet.delete()</code></a> for details.</p></li>\n<li><p>An instance of <code class=\"docutils literal notranslate\">ResolverMatch</code> is stored on the request as\n<code class=\"docutils literal notranslate\">resolver_match</code>.</p></li>\n<li><p>By default, all logging messages reaching the <code class=\"docutils literal notranslate\">django</code> logger when\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\">DEBUG</code></a> is <code class=\"docutils literal notranslate\">True</code> are sent to the console (unless you redefine the\nlogger in your <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOGGING\"><code class=\"xref std std-setting docutils literal notranslate\">LOGGING</code></a> setting).</p></li>\n<li><p>When using <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.RequestContext\" title=\"django.template.RequestContext\"><code class=\"xref py py-class docutils literal notranslate\">RequestContext</code></a>, it is now possible to\nlook up permissions by using <code class=\"docutils literal notranslate\">{% if 'someapp.someperm' in perms %}</code>\nin templates.</p></li>\n<li><p>It’s not required any more to have <code class=\"docutils literal notranslate\">404.html</code> and <code class=\"docutils literal notranslate\">500.html</code> templates in\nthe root templates directory. Django will output some basic error messages\nfor both situations when those templates are not found. It’s still\nrecommended as good practice to provide those templates in order to present\npretty error pages to the user.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/auth/#module-django.contrib.auth\" title=\"django.contrib.auth: Django's authentication framework.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.auth</code></a> provides a new signal that is emitted\nwhenever a user fails to login successfully. See\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/auth/#django.contrib.auth.signals.user_login_failed\" title=\"django.contrib.auth.signals.user_login_failed\"><code class=\"xref py py-data docutils literal notranslate\">user_login_failed</code></a></p></li>\n<li><p>The new <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#cmdoption-loaddata-ignorenonexistent\"><code class=\"xref std std-option docutils literal notranslate\">loaddata --ignorenonexistent</code></a> option ignore data for fields\nthat no longer exist.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertXMLEqual\" title=\"django.test.SimpleTestCase.assertXMLEqual\"><code class=\"xref py py-meth docutils literal notranslate\">assertXMLEqual()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertXMLNotEqual\" title=\"django.test.SimpleTestCase.assertXMLNotEqual\"><code class=\"xref py py-meth docutils literal notranslate\">assertXMLNotEqual()</code></a> new assertions allow\nyou to test equality for XML content at a semantic level, without caring for\nsyntax differences (spaces, attribute order, etc.).</p></li>\n<li><p>RemoteUserMiddleware now forces logout when the REMOTE_USER header\ndisappears during the same browser session.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/topics/http/sessions/#cached-sessions-backend\"><span class=\"std std-ref\">cache-based session backend</span></a> can store\nsession data in a non-default cache.</p></li>\n<li><p>Multi-column indexes can now be created on models. Read the\n<code class=\"docutils literal notranslate\">index_together</code> documentation for more information.</p></li>\n<li><p>During Django’s logging configuration verbose Deprecation warnings are\nenabled and warnings are captured into the logging system. Logged warnings\nare routed through the <code class=\"docutils literal notranslate\">console</code> logging handler, which by default requires\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\">DEBUG</code></a> to be True for output to be generated. The result is that\nDeprecationWarnings should be printed to the console in development\nenvironments the way they have been in Python versions &lt; 2.7.</p></li>\n<li><p>The API for <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.message_user\" title=\"django.contrib.admin.ModelAdmin.message_user\"><code class=\"xref py py-meth docutils literal notranslate\">django.contrib.admin.ModelAdmin.message_user()</code></a> method has\nbeen modified to accept additional arguments adding capabilities similar to\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/messages/#django.contrib.messages.add_message\" title=\"django.contrib.messages.add_message\"><code class=\"xref py py-func docutils literal notranslate\">django.contrib.messages.add_message()</code></a>. This is useful for generating\nerror messages from admin actions.</p></li>\n<li><p>The admin’s list filters can now be customized per-request thanks to the new\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_list_filter\" title=\"django.contrib.admin.ModelAdmin.get_list_filter\"><code class=\"xref py py-meth docutils literal notranslate\">django.contrib.admin.ModelAdmin.get_list_filter()</code></a> method.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"backwards-incompatible-changes-in-1-5\">\n<span id=\"backwards-incompatible-1-5\"></span><h2>Backwards incompatible changes in 1.5<a class=\"heading-anchor\" href=\"#backwards-incompatible-changes-in-1-5\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<aside class=\"admonition admonition-warning\" role=\"note\">\n<p class=\"admonition-title\">Warning</p>\n<p>In addition to the changes outlined in this section, be sure to review the\n<a class=\"reference internal\" href=\"/en/dev/internals/deprecation/#deprecation-removed-in-1-5\"><span class=\"std std-ref\">deprecation plan</span></a> for any features that\nhave been removed. If you haven’t updated your code within the\ndeprecation timeline for a given feature, its removal may appear as a\nbackwards incompatible change.</p>\n</aside>\n<section id=\"allowed-hosts-required-in-production\">\n<h3><code class=\"docutils literal notranslate\">ALLOWED_HOSTS</code> required in production<a class=\"heading-anchor\" href=\"#allowed-hosts-required-in-production\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The new <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-ALLOWED_HOSTS\"><code class=\"xref std std-setting docutils literal notranslate\">ALLOWED_HOSTS</code></a> setting validates the request’s <code class=\"docutils literal notranslate\">Host</code>\nheader and protects against host-poisoning attacks. This setting is now\nrequired whenever <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\">DEBUG</code></a> is <code class=\"docutils literal notranslate\">False</code>, or else\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.get_host\" title=\"django.http.HttpRequest.get_host\"><code class=\"xref py py-meth docutils literal notranslate\">django.http.HttpRequest.get_host()</code></a> will raise\n<a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.core.exceptions.SuspiciousOperation\" title=\"django.core.exceptions.SuspiciousOperation\"><code class=\"xref py py-exc docutils literal notranslate\">SuspiciousOperation</code></a>. For more details see the\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-ALLOWED_HOSTS\"><code class=\"xref std std-setting docutils literal notranslate\">full documentation</code></a> for the new setting.</p>\n</section>\n<section id=\"managers-on-abstract-models\">\n<h3>Managers on abstract models<a class=\"heading-anchor\" href=\"#managers-on-abstract-models\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Abstract models are able to define a custom manager, and that manager\n<a class=\"reference internal\" href=\"/en/dev/topics/db/managers/#custom-managers-and-inheritance\"><span class=\"std std-ref\">will be inherited by any concrete models extending the abstract model</span></a>. However, if you try to use the abstract\nmodel to call a method on the manager, an exception will now be raised.\nPreviously, the call would have been permitted, but would have failed as soon\nas any database operation was attempted (usually with a “table does not exist”\nerror from the database).</p>\n<p>If you have functionality on a manager that you have been invoking using\nthe abstract class, you should migrate that logic to a Python\n<code class=\"docutils literal notranslate\">staticmethod</code> or <code class=\"docutils literal notranslate\">classmethod</code> on the abstract class.</p>\n</section>\n<section id=\"context-in-year-archive-class-based-views\">\n<h3>Context in year archive class-based views<a class=\"heading-anchor\" href=\"#context-in-year-archive-class-based-views\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>For consistency with the other date-based generic views,\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/generic-date-based/#django.views.generic.dates.YearArchiveView\" title=\"django.views.generic.dates.YearArchiveView\"><code class=\"xref py py-class docutils literal notranslate\">YearArchiveView</code></a> now passes <code class=\"docutils literal notranslate\">year</code> in\nthe context as a <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#datetime.date\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">datetime.date</code></a> rather than a string. If you are\nusing <code class=\"docutils literal notranslate\">{{ year }}</code> in your templates, you must replace it with <code class=\"docutils literal notranslate\">{{\nyear|date:&quot;Y&quot; }}</code>.</p>\n<p><code class=\"docutils literal notranslate\">next_year</code> and <code class=\"docutils literal notranslate\">previous_year</code> were also added in the context. They are\ncalculated according to <code class=\"docutils literal notranslate\">allow_empty</code> and <code class=\"docutils literal notranslate\">allow_future</code>.</p>\n</section>\n<section id=\"context-in-year-and-month-archive-class-based-views\">\n<h3>Context in year and month archive class-based views<a class=\"heading-anchor\" href=\"#context-in-year-and-month-archive-class-based-views\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/generic-date-based/#django.views.generic.dates.YearArchiveView\" title=\"django.views.generic.dates.YearArchiveView\"><code class=\"xref py py-class docutils literal notranslate\">YearArchiveView</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/generic-date-based/#django.views.generic.dates.MonthArchiveView\" title=\"django.views.generic.dates.MonthArchiveView\"><code class=\"xref py py-class docutils literal notranslate\">MonthArchiveView</code></a> were documented to\nprovide a <code class=\"docutils literal notranslate\">date_list</code> sorted in ascending order in the context, like their\nfunction-based predecessors, but it actually was in descending order. In 1.5,\nthe documented order was restored. You may want to add (or remove) the\n<code class=\"docutils literal notranslate\">reversed</code> keyword when you’re iterating on <code class=\"docutils literal notranslate\">date_list</code> in a template:</p>\n<div class=\"code-block\" data-language=\"html+django\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Django template</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Django template code\"><code><span class=\"cp\">{%</span> <span class=\"k\">for</span> <span class=\"nv\">date</span> <span class=\"k\">in</span> <span class=\"nv\">date_list</span> <span class=\"k\">reversed</span> <span class=\"cp\">%}</span>\n</code></pre></div>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/generic-date-based/#django.views.generic.dates.ArchiveIndexView\" title=\"django.views.generic.dates.ArchiveIndexView\"><code class=\"xref py py-class docutils literal notranslate\">ArchiveIndexView</code></a> still provides a\n<code class=\"docutils literal notranslate\">date_list</code> in descending order.</p>\n</section>\n<section id=\"context-in-templateview\">\n<h3>Context in TemplateView<a class=\"heading-anchor\" href=\"#context-in-templateview\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>For consistency with the design of the other generic views,\n<a class=\"reference internal\" href=\"/en/dev/ref/class-based-views/base/#django.views.generic.base.TemplateView\" title=\"django.views.generic.base.TemplateView\"><code class=\"xref py py-class docutils literal notranslate\">TemplateView</code></a> no longer passes a <code class=\"docutils literal notranslate\">params</code>\ndictionary into the context, instead passing the variables from the URLconf\ndirectly into the context.</p>\n</section>\n<section id=\"non-form-data-in-http-requests\">\n<h3>Non-form data in HTTP requests<a class=\"heading-anchor\" href=\"#non-form-data-in-http-requests\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.POST\" title=\"django.http.HttpRequest.POST\"><code class=\"xref py py-attr docutils literal notranslate\">request.POST</code></a> will no longer include data\nposted via HTTP requests with non form-specific content-types in the header. In\nprior versions, data posted with content-types other than\n<em class=\"mimetype\">multipart/form-data</em> or\n<em class=\"mimetype\">application/x-www-form-urlencoded</em> would still end up represented in\nthe <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.POST\" title=\"django.http.HttpRequest.POST\"><code class=\"xref py py-attr docutils literal notranslate\">request.POST</code></a> attribute. Developers\nwishing to access the raw POST data for these cases, should use the\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpRequest.body\" title=\"django.http.HttpRequest.body\"><code class=\"xref py py-attr docutils literal notranslate\">request.body</code></a> attribute instead.</p>\n</section>\n<section id=\"request-finished-signal\">\n<h3><a class=\"reference internal\" href=\"/en/dev/ref/signals/#django.core.signals.request_finished\" title=\"django.core.signals.request_finished\"><code class=\"xref py py-data docutils literal notranslate\">request_finished</code></a> signal<a class=\"heading-anchor\" href=\"#request-finished-signal\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django used to send the <a class=\"reference internal\" href=\"/en/dev/ref/signals/#django.core.signals.request_finished\" title=\"django.core.signals.request_finished\"><code class=\"xref py py-data docutils literal notranslate\">request_finished</code></a> signal\nas soon as the view function returned a response. This interacted badly with\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#httpresponse-streaming\"><span class=\"std std-ref\">streaming responses</span></a> that delay content\ngeneration.</p>\n<p>This signal is now sent after the content is fully consumed by the WSGI\ngateway. This might be backwards incompatible if you rely on the signal being\nfired before sending the response content to the client. If you do, you should\nconsider using <a class=\"reference internal\" href=\"/en/dev/topics/http/middleware/\"><span class=\"doc\">middleware</span></a> instead.</p>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>Some WSGI servers and middleware do not always call <code class=\"docutils literal notranslate\">close</code> on the\nresponse object after handling a request, most notably uWSGI prior to 1.2.6\nand Sentry’s error reporting middleware up to 2.0.7. In those cases the\n<code class=\"docutils literal notranslate\">request_finished</code> signal isn’t sent at all. This can result in idle\nconnections to database and memcache servers.</p>\n</aside>\n</section>\n<section id=\"options-put-and-delete-requests-in-the-test-client\">\n<h3>OPTIONS, PUT and DELETE requests in the test client<a class=\"heading-anchor\" href=\"#options-put-and-delete-requests-in-the-test-client\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Unlike GET and POST, these HTTP methods aren’t implemented by web browsers.\nRather, they’re used in APIs, which transfer data in various formats such as\nJSON or XML. Since such requests may contain arbitrary data, Django doesn’t\nattempt to decode their body.</p>\n<p>However, the test client used to build a query string for OPTIONS and DELETE\nrequests like for GET, and a request body for PUT requests like for POST. This\nencoding was arbitrary and inconsistent with Django’s behavior when it\nreceives the requests, so it was removed in Django 1.5.</p>\n<p>If you were using the <code class=\"docutils literal notranslate\">data</code> parameter in an OPTIONS or a DELETE request,\nyou must convert it to a query string and append it to the <code class=\"docutils literal notranslate\">path</code> parameter.</p>\n<p>If you were using the <code class=\"docutils literal notranslate\">data</code> parameter in a PUT request without a\n<code class=\"docutils literal notranslate\">content_type</code>, you must encode your data before passing it to the test\nclient and set the <code class=\"docutils literal notranslate\">content_type</code> argument.</p>\n</section>\n<section id=\"system-version-of-simplejson-no-longer-used\">\n<span id=\"simplejson-incompatibilities\"></span><h3>System version of <code class=\"docutils literal notranslate\">simplejson</code> no longer used<a class=\"heading-anchor\" href=\"#system-version-of-simplejson-no-longer-used\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"#simplejson-deprecation\"><span class=\"std std-ref\">As explained below</span></a>, Django 1.5 deprecates\n<code class=\"docutils literal notranslate\">django.utils.simplejson</code> in favor of Python 2.6’s built-in <a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a>\nmodule. In theory, this change is harmless. Unfortunately, because of\nincompatibilities between versions of <code class=\"docutils literal notranslate\">simplejson</code>, it may trigger errors\nin some circumstances.</p>\n<p>JSON-related features in Django 1.4 always used <code class=\"docutils literal notranslate\">django.utils.simplejson</code>.\nThis module was actually:</p>\n<ul class=\"simple\">\n<li><p>A system version of <code class=\"docutils literal notranslate\">simplejson</code>, if one was available (i.e. <code class=\"docutils literal notranslate\">import\nsimplejson</code> works), if it was more recent than Django’s built-in copy or it\nhad the C speedups, or</p></li>\n<li><p>The <a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a> module from the standard library, if it was available (i.e.\nPython 2.6 or greater), or</p></li>\n<li><p>A built-in copy of version 2.0.7 of <code class=\"docutils literal notranslate\">simplejson</code>.</p></li>\n</ul>\n<p>In Django 1.5, those features use Python’s <a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a> module, which is based\non version 2.0.9 of <code class=\"docutils literal notranslate\">simplejson</code>.</p>\n<p>There are no known incompatibilities between Django’s copy of version 2.0.7 and\nPython’s copy of version 2.0.9. However, there are some incompatibilities\nbetween other versions of <code class=\"docutils literal notranslate\">simplejson</code>:</p>\n<ul class=\"simple\">\n<li><p>While the <code class=\"docutils literal notranslate\">simplejson</code> API is documented as always returning Unicode\nstrings, the optional C implementation can return a bytestring. This was\nfixed in Python 2.7.</p></li>\n<li><p><code class=\"docutils literal notranslate\">simplejson.JSONEncoder</code> gained a <code class=\"docutils literal notranslate\">namedtuple_as_object</code> keyword\nargument in version 2.2.</p></li>\n</ul>\n<p>More information on these incompatibilities is available in\n<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/18023#comment:10\">ticket #18023</a>.</p>\n<p>The net result is that, if you have installed <code class=\"docutils literal notranslate\">simplejson</code> and your code\nuses Django’s serialization internals directly – for instance\n<code class=\"docutils literal notranslate\">django.core.serializers.json.DjangoJSONEncoder</code>, the switch from\n<code class=\"docutils literal notranslate\">simplejson</code> to <a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a> could break your code. (In general, changes to\ninternals aren’t documented; we’re making an exception here.)</p>\n<p>At this point, the maintainers of Django believe that using <a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a> from\nthe standard library offers the strongest guarantee of backwards-compatibility.\nThey recommend to use it from now on.</p>\n</section>\n<section id=\"string-types-of-hasher-method-parameters\">\n<h3>String types of hasher method parameters<a class=\"heading-anchor\" href=\"#string-types-of-hasher-method-parameters\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you have written a <a class=\"reference internal\" href=\"/en/dev/topics/auth/passwords/#auth-password-storage\"><span class=\"std std-ref\">custom password hasher</span></a>,\nyour <code class=\"docutils literal notranslate\">encode()</code>, <code class=\"docutils literal notranslate\">verify()</code> or <code class=\"docutils literal notranslate\">safe_summary()</code> methods should accept\nUnicode parameters (<code class=\"docutils literal notranslate\">password</code>, <code class=\"docutils literal notranslate\">salt</code> or <code class=\"docutils literal notranslate\">encoded</code>). If any of the\nhashing methods need bytestrings, you can use the\n<a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.encoding.force_bytes\" title=\"django.utils.encoding.force_bytes\"><code class=\"xref py py-func docutils literal notranslate\">force_bytes()</code></a> utility to encode the strings.</p>\n</section>\n<section id=\"validation-of-previous-page-number-and-next-page-number\">\n<h3>Validation of previous_page_number and next_page_number<a class=\"heading-anchor\" href=\"#validation-of-previous-page-number-and-next-page-number\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>When using <a class=\"reference internal\" href=\"/en/dev/topics/pagination/\"><span class=\"doc\">object pagination</span></a>,\nthe <code class=\"docutils literal notranslate\">previous_page_number()</code> and <code class=\"docutils literal notranslate\">next_page_number()</code> methods of the\n<a class=\"reference internal\" href=\"/en/dev/ref/paginator/#django.core.paginator.Page\" title=\"django.core.paginator.Page\"><code class=\"xref py py-class docutils literal notranslate\">Page</code></a> object did not check if the returned\nnumber was inside the existing page range.\nIt does check it now and raises an <a class=\"reference internal\" href=\"/en/dev/ref/paginator/#django.core.paginator.InvalidPage\" title=\"django.core.paginator.InvalidPage\"><code class=\"xref py py-exc docutils literal notranslate\">InvalidPage</code></a>\nexception when the number is either too low or too high.</p>\n</section>\n<section id=\"behavior-of-autocommit-database-option-on-postgresql-changed\">\n<h3>Behavior of autocommit database option on PostgreSQL changed<a class=\"heading-anchor\" href=\"#behavior-of-autocommit-database-option-on-postgresql-changed\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>PostgreSQL’s autocommit option didn’t work as advertised previously. It did\nwork for single transaction block, but after the first block was left the\nautocommit behavior was never restored. This bug is now fixed in 1.5. While\nthis is only a bug fix, it is worth checking your applications behavior if\nyou are using PostgreSQL together with the autocommit option.</p>\n</section>\n<section id=\"session-not-saved-on-500-responses\">\n<h3>Session not saved on 500 responses<a class=\"heading-anchor\" href=\"#session-not-saved-on-500-responses\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django’s session middleware will skip saving the session data if the\nresponse’s status code is 500.</p>\n</section>\n<section id=\"email-checks-on-failed-admin-login\">\n<h3>Email checks on failed admin login<a class=\"heading-anchor\" href=\"#email-checks-on-failed-admin-login\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Prior to Django 1.5, if you attempted to log into the admin interface and\nmistakenly used your email address instead of your username, the admin\ninterface would provide a warning advising that your email address was\nnot your username. In Django 1.5, the introduction of\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#auth-custom-user\"><span class=\"std std-ref\">custom user models</span></a> has required the removal of this\nwarning. This doesn’t change the login behavior of the admin site; it only\naffects the warning message that is displayed under one particular mode of\nlogin failure.</p>\n</section>\n<section id=\"changes-in-tests-execution\">\n<h3>Changes in tests execution<a class=\"heading-anchor\" href=\"#changes-in-tests-execution\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Some changes have been introduced in the execution of tests that might be\nbackward-incompatible for some testing setups:</p>\n<section id=\"database-flushing-in-django-test-transactiontestcase\">\n<h4>Database flushing in <code class=\"docutils literal notranslate\">django.test.TransactionTestCase</code><a class=\"heading-anchor\" href=\"#database-flushing-in-django-test-transactiontestcase\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Previously, the test database was truncated <em>before</em> each test run in a\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TransactionTestCase\" title=\"django.test.TransactionTestCase\"><code class=\"xref py py-class docutils literal notranslate\">TransactionTestCase</code></a>.</p>\n<p>In order to be able to run unit tests in any order and to make sure they are\nalways isolated from each other, <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TransactionTestCase\" title=\"django.test.TransactionTestCase\"><code class=\"xref py py-class docutils literal notranslate\">TransactionTestCase</code></a> will\nnow reset the database <em>after</em> each test run instead.</p>\n</section>\n<section id=\"no-more-implicit-db-sequences-reset\">\n<h4>No more implicit DB sequences reset<a class=\"heading-anchor\" href=\"#no-more-implicit-db-sequences-reset\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TransactionTestCase\" title=\"django.test.TransactionTestCase\"><code class=\"xref py py-class docutils literal notranslate\">TransactionTestCase</code></a> tests used to reset primary key\nsequences automatically together with the database flushing actions described\nabove.</p>\n<p>This has been changed so no sequences are implicitly reset. This can cause\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TransactionTestCase\" title=\"django.test.TransactionTestCase\"><code class=\"xref py py-class docutils literal notranslate\">TransactionTestCase</code></a> tests that depend on hardcoded\nprimary key values to break.</p>\n<p>The new <a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.TransactionTestCase.reset_sequences\" title=\"django.test.TransactionTestCase.reset_sequences\"><code class=\"xref py py-attr docutils literal notranslate\">reset_sequences</code></a> attribute can\nbe used to force the old behavior for <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TransactionTestCase\" title=\"django.test.TransactionTestCase\"><code class=\"xref py py-class docutils literal notranslate\">TransactionTestCase</code></a>\nthat might need it.</p>\n</section>\n<section id=\"ordering-of-tests\">\n<h4>Ordering of tests<a class=\"heading-anchor\" href=\"#ordering-of-tests\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>In order to make sure all <code class=\"docutils literal notranslate\">TestCase</code> code starts with a clean database,\ntests are now executed in the following order:</p>\n<ul class=\"simple\">\n<li><p>First, all unit tests (including <a class=\"reference external\" href=\"https://docs.python.org/3/library/unittest.html#unittest.TestCase\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">unittest.TestCase</code></a>,\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.SimpleTestCase\" title=\"django.test.SimpleTestCase\"><code class=\"xref py py-class docutils literal notranslate\">SimpleTestCase</code></a>, <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TestCase\" title=\"django.test.TestCase\"><code class=\"xref py py-class docutils literal notranslate\">TestCase</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TransactionTestCase\" title=\"django.test.TransactionTestCase\"><code class=\"xref py py-class docutils literal notranslate\">TransactionTestCase</code></a>) are run with no particular\nordering guaranteed nor enforced among them.</p></li>\n<li><p>Then any other tests (e.g. doctests) that may alter the database without\nrestoring it to its original state are run.</p></li>\n</ul>\n<p>This should not cause any problems unless you have existing doctests which\nassume a <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TransactionTestCase\" title=\"django.test.TransactionTestCase\"><code class=\"xref py py-class docutils literal notranslate\">TransactionTestCase</code></a> executed earlier left some\ndatabase state behind or unit tests that rely on some form of state being\npreserved after the execution of other tests. Such tests are already very\nfragile, and must now be changed to be able to run independently.</p>\n</section>\n</section>\n<section id=\"cleaned-data-dictionary-kept-for-invalid-forms\">\n<h3><code class=\"docutils literal notranslate\">cleaned_data</code> dictionary kept for invalid forms<a class=\"heading-anchor\" href=\"#cleaned-data-dictionary-kept-for-invalid-forms\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.cleaned_data\" title=\"django.forms.Form.cleaned_data\"><code class=\"xref py py-attr docutils literal notranslate\">cleaned_data</code></a> dictionary is now always present\nafter form validation. When the form doesn’t validate, it contains only the\nfields that passed validation. You should test the success of the validation\nwith the <a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.is_valid\" title=\"django.forms.Form.is_valid\"><code class=\"xref py py-meth docutils literal notranslate\">is_valid()</code></a> method and not with the\npresence or absence of the <a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.Form.cleaned_data\" title=\"django.forms.Form.cleaned_data\"><code class=\"xref py py-attr docutils literal notranslate\">cleaned_data</code></a> attribute\non the form.</p>\n</section>\n<section id=\"behavior-of-syncdb-with-multiple-databases\">\n<h3>Behavior of <code class=\"docutils literal notranslate\">syncdb</code> with multiple databases<a class=\"heading-anchor\" href=\"#behavior-of-syncdb-with-multiple-databases\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">syncdb</code> now queries the database routers to determine if content\ntypes (when <a class=\"reference internal\" href=\"/en/dev/ref/contrib/contenttypes/#module-django.contrib.contenttypes\" title=\"django.contrib.contenttypes: Provides generic interface to installed models.\"><code class=\"xref py py-mod docutils literal notranslate\">contenttypes</code></a> is enabled) and permissions\n(when <a class=\"reference internal\" href=\"/en/dev/topics/auth/#module-django.contrib.auth\" title=\"django.contrib.auth: Django's authentication framework.\"><code class=\"xref py py-mod docutils literal notranslate\">auth</code></a> is enabled) should be created in the target\ndatabase. Previously, it created them in the default database, even when\nanother database was specified with the <code class=\"docutils literal notranslate\">--database</code> option.</p>\n<p>If you use <code class=\"docutils literal notranslate\">syncdb</code> on multiple databases, you should ensure that\nyour routers allow synchronizing content types and permissions to only one of\nthem. See the docs on the <a class=\"reference internal\" href=\"/en/dev/topics/db/multi-db/#contrib-app-multiple-databases\"><span class=\"std std-ref\">behavior of contrib apps with multiple\ndatabases</span></a> for more information.</p>\n</section>\n<section id=\"xml-deserializer-will-not-parse-documents-with-a-dtd\">\n<h3>XML deserializer will not parse documents with a DTD<a class=\"heading-anchor\" href=\"#xml-deserializer-will-not-parse-documents-with-a-dtd\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In order to prevent exposure to denial-of-service attacks related to external\nentity references and entity expansion, the XML model deserializer now refuses\nto parse XML documents containing a DTD (DOCTYPE definition). Since the XML\nserializer does not output a DTD, this will not impact typical usage, only\ncases where custom-created XML documents are passed to Django’s model\ndeserializer.</p>\n</section>\n<section id=\"formsets-default-max-num\">\n<h3>Formsets default <code class=\"docutils literal notranslate\">max_num</code><a class=\"heading-anchor\" href=\"#formsets-default-max-num\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>A (default) value of <code class=\"docutils literal notranslate\">None</code> for the <code class=\"docutils literal notranslate\">max_num</code> argument to a formset factory\nno longer defaults to allowing any number of forms in the formset. Instead, in\norder to prevent memory-exhaustion attacks, it now defaults to a limit of 1000\nforms. This limit can be raised by explicitly setting a higher value for\n<code class=\"docutils literal notranslate\">max_num</code>.</p>\n</section>\n<section id=\"miscellaneous\">\n<h3>Miscellaneous<a class=\"heading-anchor\" href=\"#miscellaneous\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.ModelMultipleChoiceField\" title=\"django.forms.ModelMultipleChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">django.forms.ModelMultipleChoiceField</code></a> now returns an empty\n<code class=\"docutils literal notranslate\">QuerySet</code> as the empty value instead of an empty list.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.http.int_to_base36\" title=\"django.utils.http.int_to_base36\"><code class=\"xref py py-func docutils literal notranslate\">int_to_base36()</code></a> properly raises a\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/exceptions.html#TypeError\" title=\"(in Python v3.14)\"><code class=\"xref py py-exc docutils literal notranslate\">TypeError</code></a> instead of <a class=\"reference external\" href=\"https://docs.python.org/3/library/exceptions.html#ValueError\" title=\"(in Python v3.14)\"><code class=\"xref py py-exc docutils literal notranslate\">ValueError</code></a> for non-integer inputs.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">slugify</code> template filter is now available as a standard Python\nfunction at <a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.text.slugify\" title=\"django.utils.text.slugify\"><code class=\"xref py py-func docutils literal notranslate\">django.utils.text.slugify()</code></a>. Similarly, <code class=\"docutils literal notranslate\">remove_tags</code> is\navailable at <code class=\"docutils literal notranslate\">django.utils.html.remove_tags()</code>.</p></li>\n<li><p>Uploaded files are no longer created as executable by default. If you need\nthem to be executable change <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-FILE_UPLOAD_PERMISSIONS\"><code class=\"xref std std-setting docutils literal notranslate\">FILE_UPLOAD_PERMISSIONS</code></a> to your\nneeds. The new default value is <code class=\"docutils literal notranslate\">0o666</code> (octal) and the current umask value\nis first masked out.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.F\" title=\"django.db.models.F\"><code class=\"xref py py-class docutils literal notranslate\">F expressions</code></a> supported bitwise operators\nby <code class=\"docutils literal notranslate\">&amp;</code> and <code class=\"docutils literal notranslate\">|</code>. These operators are now available using <code class=\"docutils literal notranslate\">.bitand()</code> and\n<code class=\"docutils literal notranslate\">.bitor()</code> instead. The removal of <code class=\"docutils literal notranslate\">&amp;</code> and <code class=\"docutils literal notranslate\">|</code> was done to be\nconsistent with <a class=\"reference internal\" href=\"/en/dev/topics/db/queries/#complex-lookups-with-q\"><span class=\"std std-ref\">Q() expressions</span></a> and\n<code class=\"docutils literal notranslate\">QuerySet</code> combining where the operators are used as boolean AND and OR\noperators.</p></li>\n<li><p>In a <code class=\"docutils literal notranslate\">filter()</code> call, when <a class=\"reference internal\" href=\"/en/dev/ref/models/expressions/#django.db.models.F\" title=\"django.db.models.F\"><code class=\"xref py py-class docutils literal notranslate\">F expressions</code></a>\ncontained lookups spanning multi-valued relations, they didn’t always reuse\nthe same relations as other lookups along the same chain. This was changed,\nand now F() expressions will always use the same relations as other lookups\nwithin the same <code class=\"docutils literal notranslate\">filter()</code> call.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-csrf_token\"><code class=\"xref std std-ttag docutils literal notranslate\">csrf_token</code></a> template tag is no longer enclosed in a div. If you\nneed HTML validation against pre-HTML5 Strict DTDs, you should add a div\naround it in your pages.</p></li>\n<li><p>The template tags library <code class=\"docutils literal notranslate\">adminmedia</code>, which only contained the\ndeprecated template tag <code class=\"docutils literal notranslate\">{% admin_media_prefix %}</code>, was removed.\nAttempting to load it with <code class=\"docutils literal notranslate\">{% load adminmedia %}</code> will fail. If your\ntemplates still contain that line you must remove it.</p></li>\n<li><p>Because of an implementation oversight, it was possible to use\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/redirects/\"><span class=\"doc\">django.contrib.redirects</span></a> without enabling\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/sites/\"><span class=\"doc\">django.contrib.sites</span></a>. This isn’t allowed any\nlonger. If you’re using <code class=\"docutils literal notranslate\">django.contrib.redirects</code>, make sure\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-INSTALLED_APPS\"><code class=\"xref std std-setting docutils literal notranslate\">INSTALLED_APPS</code></a> contains <code class=\"docutils literal notranslate\">django.contrib.sites</code>.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/forms/api/#django.forms.BoundField.label_tag\" title=\"django.forms.BoundField.label_tag\"><code class=\"xref py py-meth docutils literal notranslate\">BoundField.label_tag</code></a> now\nescapes its <code class=\"docutils literal notranslate\">contents</code> argument. To avoid the HTML escaping, use\n<a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.safestring.mark_safe\" title=\"django.utils.safestring.mark_safe\"><code class=\"xref py py-func docutils literal notranslate\">django.utils.safestring.mark_safe()</code></a> on the argument before passing it.</p></li>\n<li><p>Accessing reverse one-to-one relations fetched via\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_related\" title=\"django.db.models.query.QuerySet.select_related\"><code class=\"xref py py-meth docutils literal notranslate\">select_related()</code></a> now raises\n<a class=\"reference internal\" href=\"/en/dev/ref/models/class/#django.db.models.Model.DoesNotExist\" title=\"django.db.models.Model.DoesNotExist\"><code class=\"xref py py-exc docutils literal notranslate\">DoesNotExist</code></a> instead of returning <code class=\"docutils literal notranslate\">None</code>.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"features-deprecated-in-1-5\">\n<span id=\"deprecated-features-1-5\"></span><h2>Features deprecated in 1.5<a class=\"heading-anchor\" href=\"#features-deprecated-in-1-5\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"django-contrib-localflavor\">\n<h3><code class=\"docutils literal notranslate\">django.contrib.localflavor</code><a class=\"heading-anchor\" href=\"#django-contrib-localflavor\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The localflavor contrib app has been split into separate packages.\n<code class=\"docutils literal notranslate\">django.contrib.localflavor</code> itself will be removed in Django 1.6,\nafter an accelerated deprecation.</p>\n<p>The new packages are available on GitHub. The core team cannot\nefficiently maintain these packages in the long term — it spans just a\ndozen countries at this time; similar to translations, maintenance\nwill be handed over to interested members of the community.</p>\n</section>\n<section id=\"django-contrib-markup\">\n<h3><code class=\"docutils literal notranslate\">django.contrib.markup</code><a class=\"heading-anchor\" href=\"#django-contrib-markup\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The markup contrib module has been deprecated and will follow an accelerated\ndeprecation schedule. Direct use of Python markup libraries or 3rd party tag\nlibraries is preferred to Django maintaining this functionality in the\nframework.</p>\n</section>\n<section id=\"auth-profile-module\">\n<h3><code class=\"docutils literal notranslate\">AUTH_PROFILE_MODULE</code><a class=\"heading-anchor\" href=\"#auth-profile-module\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>With the introduction of <a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#auth-custom-user\"><span class=\"std std-ref\">custom user models</span></a>, there is\nno longer any need for a built-in mechanism to store user profile data.</p>\n<p>You can still define user profiles models that have a one-to-one relation with\nthe User model - in fact, for many applications needing to associate data with\na User account, this will be an appropriate design pattern to follow. However,\nthe <code class=\"docutils literal notranslate\">AUTH_PROFILE_MODULE</code> setting, and the\n<code class=\"docutils literal notranslate\">django.contrib.auth.models.User.get_profile()</code> method for accessing\nthe user profile model, should not be used any longer.</p>\n</section>\n<section id=\"streaming-behavior-of-httpresponse\">\n<h3>Streaming behavior of <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a><a class=\"heading-anchor\" href=\"#streaming-behavior-of-httpresponse\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.5 deprecates the ability to stream a response by passing an iterator\nto <a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a>. If you rely on this behavior, switch to\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.StreamingHttpResponse\" title=\"django.http.StreamingHttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">StreamingHttpResponse</code></a>. See\n<a class=\"reference internal\" href=\"#explicit-streaming-responses\"><span class=\"std std-ref\">Explicit support for streaming responses</span></a> above.</p>\n<p>In Django 1.7 and above, the iterator will be consumed immediately by\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a>.</p>\n</section>\n<section id=\"django-utils-simplejson\">\n<span id=\"simplejson-deprecation\"></span><h3><code class=\"docutils literal notranslate\">django.utils.simplejson</code><a class=\"heading-anchor\" href=\"#django-utils-simplejson\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Since Django 1.5 drops support for Python 2.5, we can now rely on the\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a> module being available in Python’s standard library, so we’ve\nremoved our own copy of <code class=\"docutils literal notranslate\">simplejson</code>. You should now import <a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a>\ninstead of <code class=\"docutils literal notranslate\">django.utils.simplejson</code>.</p>\n<p>Unfortunately, this change might have unwanted side-effects, because of\nincompatibilities between versions of <code class=\"docutils literal notranslate\">simplejson</code> – see the\n<a class=\"reference internal\" href=\"#simplejson-incompatibilities\"><span class=\"std std-ref\">backwards-incompatible changes</span></a> section.\nIf you rely on features added to <code class=\"docutils literal notranslate\">simplejson</code> after it became Python’s\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a>, you should import <code class=\"docutils literal notranslate\">simplejson</code> explicitly.</p>\n</section>\n<section id=\"django-utils-encoding-strandunicode\">\n<h3><code class=\"docutils literal notranslate\">django.utils.encoding.StrAndUnicode</code><a class=\"heading-anchor\" href=\"#django-utils-encoding-strandunicode\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">django.utils.encoding.StrAndUnicode</code> mix-in has been deprecated.\nDefine a <code class=\"docutils literal notranslate\">__str__</code> method and apply the\n<code class=\"docutils literal notranslate\">django.utils.encoding.python_2_unicode_compatible</code> decorator instead.</p>\n</section>\n<section id=\"django-utils-itercompat-product\">\n<h3><code class=\"docutils literal notranslate\">django.utils.itercompat.product</code><a class=\"heading-anchor\" href=\"#django-utils-itercompat-product\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">django.utils.itercompat.product</code> function has been deprecated. Use\nthe built-in <a class=\"reference external\" href=\"https://docs.python.org/3/library/itertools.html#itertools.product\" title=\"(in Python v3.14)\"><code class=\"xref py py-func docutils literal notranslate\">itertools.product()</code></a> instead.</p>\n</section>\n<section id=\"cleanup-management-command\">\n<h3><code class=\"docutils literal notranslate\">cleanup</code> management command<a class=\"heading-anchor\" href=\"#cleanup-management-command\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">cleanup</code> management command has been deprecated and replaced by\n<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-clearsessions\"><code class=\"xref std std-djadmin docutils literal notranslate\">clearsessions</code></a>.</p>\n</section>\n<section id=\"daily-cleanup-py-script\">\n<h3><code class=\"docutils literal notranslate\">daily_cleanup.py</code> script<a class=\"heading-anchor\" href=\"#daily-cleanup-py-script\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The undocumented <code class=\"docutils literal notranslate\">daily_cleanup.py</code> script has been deprecated. Use the\n<a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-clearsessions\"><code class=\"xref std std-djadmin docutils literal notranslate\">clearsessions</code></a> management command instead.</p>\n</section>\n<section id=\"depth-keyword-argument-in-select-related\">\n<h3><code class=\"docutils literal notranslate\">depth</code> keyword argument in <code class=\"docutils literal notranslate\">select_related</code><a class=\"heading-anchor\" href=\"#depth-keyword-argument-in-select-related\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">depth</code> keyword argument in\n<a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_related\" title=\"django.db.models.query.QuerySet.select_related\"><code class=\"xref py py-meth docutils literal notranslate\">select_related()</code></a> has been deprecated.\nYou should use field names instead.</p>\n</section>\n</section>","rootId":"django-1-5-release-notes","toc":[{"title":"Overview","anchor":"overview","children":[]},{"title":"Python compatibility","anchor":"python-compatibility","children":[{"title":"Python 3 support","anchor":"python-3-support","children":[]}]},{"title":"What’s new in Django 1.5","anchor":"what-s-new-in-django-1-5","children":[{"title":"Configurable User model","anchor":"configurable-user-model","children":[]},{"title":"Support for saving a subset of model’s fields","anchor":"support-for-saving-a-subset-of-model-s-fields","children":[]},{"title":"Caching of related model instances","anchor":"caching-of-related-model-instances","children":[]},{"title":"Explicit support for streaming responses","anchor":"explicit-support-for-streaming-responses","children":[]},{"title":"{% verbatim %} template tag","anchor":"verbatim-template-tag","children":[]},{"title":"Retrieval of ContentType instances associated with proxy models","anchor":"retrieval-of-contenttype-instances-associated-with-proxy-models","children":[]},{"title":"New view variable in class-based views context","anchor":"new-view-variable-in-class-based-views-context","children":[]},{"title":"GeoDjango","anchor":"geodjango","children":[]},{"title":"New tutorials","anchor":"new-tutorials","children":[]},{"title":"Minor features","anchor":"minor-features","children":[]}]},{"title":"Backwards incompatible changes in 1.5","anchor":"backwards-incompatible-changes-in-1-5","children":[{"title":"ALLOWED_HOSTS required in production","anchor":"allowed-hosts-required-in-production","children":[]},{"title":"Managers on abstract models","anchor":"managers-on-abstract-models","children":[]},{"title":"Context in year archive class-based views","anchor":"context-in-year-archive-class-based-views","children":[]},{"title":"Context in year and month archive class-based views","anchor":"context-in-year-and-month-archive-class-based-views","children":[]},{"title":"Context in TemplateView","anchor":"context-in-templateview","children":[]},{"title":"Non-form data in HTTP requests","anchor":"non-form-data-in-http-requests","children":[]},{"title":"request_finished signal","anchor":"request-finished-signal","children":[]},{"title":"OPTIONS, PUT and DELETE requests in the test client","anchor":"options-put-and-delete-requests-in-the-test-client","children":[]},{"title":"System version of simplejson no longer used","anchor":"system-version-of-simplejson-no-longer-used","children":[]},{"title":"String types of hasher method parameters","anchor":"string-types-of-hasher-method-parameters","children":[]},{"title":"Validation of previous_page_number and next_page_number","anchor":"validation-of-previous-page-number-and-next-page-number","children":[]},{"title":"Behavior of autocommit database option on PostgreSQL changed","anchor":"behavior-of-autocommit-database-option-on-postgresql-changed","children":[]},{"title":"Session not saved on 500 responses","anchor":"session-not-saved-on-500-responses","children":[]},{"title":"Email checks on failed admin login","anchor":"email-checks-on-failed-admin-login","children":[]},{"title":"Changes in tests execution","anchor":"changes-in-tests-execution","children":[{"title":"Database flushing in django.test.TransactionTestCase","anchor":"database-flushing-in-django-test-transactiontestcase","children":[]},{"title":"No more implicit DB sequences reset","anchor":"no-more-implicit-db-sequences-reset","children":[]},{"title":"Ordering of tests","anchor":"ordering-of-tests","children":[]}]},{"title":"cleaned_data dictionary kept for invalid forms","anchor":"cleaned-data-dictionary-kept-for-invalid-forms","children":[]},{"title":"Behavior of syncdb with multiple databases","anchor":"behavior-of-syncdb-with-multiple-databases","children":[]},{"title":"XML deserializer will not parse documents with a DTD","anchor":"xml-deserializer-will-not-parse-documents-with-a-dtd","children":[]},{"title":"Formsets default max_num","anchor":"formsets-default-max-num","children":[]},{"title":"Miscellaneous","anchor":"miscellaneous","children":[]}]},{"title":"Features deprecated in 1.5","anchor":"features-deprecated-in-1-5","children":[{"title":"django.contrib.localflavor","anchor":"django-contrib-localflavor","children":[]},{"title":"django.contrib.markup","anchor":"django-contrib-markup","children":[]},{"title":"AUTH_PROFILE_MODULE","anchor":"auth-profile-module","children":[]},{"title":"Streaming behavior of HttpResponse","anchor":"streaming-behavior-of-httpresponse","children":[]},{"title":"django.utils.simplejson","anchor":"django-utils-simplejson","children":[]},{"title":"django.utils.encoding.StrAndUnicode","anchor":"django-utils-encoding-strandunicode","children":[]},{"title":"django.utils.itercompat.product","anchor":"django-utils-itercompat-product","children":[]},{"title":"cleanup management command","anchor":"cleanup-management-command","children":[]},{"title":"daily_cleanup.py script","anchor":"daily-cleanup-py-script","children":[]},{"title":"depth keyword argument in select_related","anchor":"depth-keyword-argument-in-select-related","children":[]}]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.5.1","title":"Django 1.5.1 release notes","url":"/en/dev/releases/1.5.1/"},"next":{"docname":"releases/1.4.22","title":"Django 1.4.22 release notes","url":"/en/dev/releases/1.4.22/"},"formats":{"html":"/en/dev/releases/1.5/","markdown":"/en/dev/releases/1.5.md","json":"/en/dev/releases/1.5.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.5.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.5/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9","1.8"],"inLocales":["en"]}