{"title":"Django 1.3 release notes","version":"dev","locale":"en","docname":"releases/1.3","url":"/en/dev/releases/1.3/","canonical":"https://djangodocs.dev/en/dev/releases/1.3/","summary":"Welcome to Django 1.3! Nearly a year in the making, Django 1.3 includes quite a few new features and plenty of bug fixes and improvements to existing…","html":"<h1>Django 1.3 release notes<a class=\"heading-anchor\" href=\"#django-1-3-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>March 23, 2011</em></p>\n<p>Welcome to Django 1.3!</p>\n<p>Nearly a year in the making, Django 1.3 includes quite a few <a class=\"reference internal\" href=\"#whats-new-1-3\"><span class=\"std std-ref\">new features</span></a> and plenty of bug fixes and improvements to existing features.\nThese release notes cover the new features in 1.3, as well as some\n<a class=\"reference internal\" href=\"#backwards-incompatible-changes-1-3\"><span class=\"std std-ref\">backwards-incompatible changes</span></a>\nyou’ll want to be aware of when upgrading from Django 1.2 or older versions.</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>Django 1.3’s focus has mostly been on resolving smaller, long-standing\nfeature requests, but that hasn’t prevented a few fairly significant\nnew features from landing, including:</p>\n<ul class=\"simple\">\n<li><p>A framework for writing <a class=\"reference internal\" href=\"#class-based-views\">class-based views</a>.</p></li>\n<li><p>Built-in support for <a class=\"reference internal\" href=\"#logging\">using Python’s logging facilities</a>.</p></li>\n<li><p>Contrib support for <a class=\"reference internal\" href=\"#extended-static-files-handling\">easy handling of static files</a>.</p></li>\n<li><p>Django’s testing framework now supports (and ships with a copy of)\n<a class=\"reference internal\" href=\"#unittest2-support\">the unittest2 library</a>.</p></li>\n</ul>\n<p>Wherever possible, new features are introduced in a backwards-compatible manner\nper <a class=\"reference internal\" href=\"/en/dev/misc/api-stability/\"><span class=\"doc\">our API stability policy</span></a> policy. As a result\nof this policy, Django 1.3 <a class=\"reference internal\" href=\"#deprecated-features-1-3\"><span class=\"std std-ref\">begins the deprecation process for some\nfeatures</span></a>.</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>The release of Django 1.2 was notable for having the first shift in\nDjango’s Python compatibility policy; prior to Django 1.2, Django\nsupported any 2.x version of Python from 2.3 up. As of Django 1.2, the\nminimum requirement was raised to Python 2.4.</p>\n<p>Django 1.3 continues to support Python 2.4, but will be the final\nDjango release series to do so; beginning with Django 1.4, the minimum\nsupported Python version will be 2.5. A document outlining our full\ntimeline for deprecating Python 2.x and moving to Python 3.x will be\npublished shortly after the release of Django 1.3.</p>\n</section>\n<section id=\"what-s-new-in-django-1-3\">\n<span id=\"whats-new-1-3\"></span><h2>What’s new in Django 1.3<a class=\"heading-anchor\" href=\"#what-s-new-in-django-1-3\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"class-based-views\">\n<h3>Class-based views<a class=\"heading-anchor\" href=\"#class-based-views\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.3 adds a framework that allows you to use a class as a view.\nThis means you can compose a view out of a collection of methods that\ncan be subclassed and overridden to provide common views of data without\nhaving to write too much code.</p>\n<p>Analogs of all the old function-based generic views have been\nprovided, along with a completely generic view base class that can be\nused as the basis for reusable applications that can be easily\nextended.</p>\n<p>See <a class=\"reference internal\" href=\"/en/dev/topics/class-based-views/\"><span class=\"doc\">the documentation on class-based generic views</span></a> for more details. There is also a document\nto help you <a class=\"reference external\" href=\"https://raw.githubusercontent.com/django/django/ea9dc9f4b03ae034c1dc080730422dda7a9c2e47/docs/topics/generic-views-migration.txt\">convert your function-based generic views to class-based views</a>.</p>\n</section>\n<section id=\"logging\">\n<h3>Logging<a class=\"heading-anchor\" href=\"#logging\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.3 adds framework-level support for Python’s <code class=\"docutils literal notranslate\">logging</code>\nmodule. This means you can now easily configure and control logging\nas part of your Django project. A number of logging handlers and\nlogging calls have been added to Django’s own code as well – most\nnotably, the error emails sent on an HTTP 500 server error are now\nhandled as a logging activity. See <a class=\"reference internal\" href=\"/en/dev/topics/logging/\"><span class=\"doc\">the documentation on Django’s\nlogging interface</span></a> for more details.</p>\n</section>\n<section id=\"extended-static-files-handling\">\n<h3>Extended static files handling<a class=\"heading-anchor\" href=\"#extended-static-files-handling\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.3 ships with a new contrib app –\n<code class=\"docutils literal notranslate\">django.contrib.staticfiles</code> – to help developers handle the static\nmedia files (images, CSS, JavaScript, etc.) that are needed to render\na complete web page.</p>\n<p>In previous versions of Django, it was common to place static assets\nin <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-MEDIA_ROOT\"><code class=\"xref std std-setting docutils literal notranslate\">MEDIA_ROOT</code></a> along with user-uploaded files, and serve\nthem both at <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-MEDIA_URL\"><code class=\"xref std std-setting docutils literal notranslate\">MEDIA_URL</code></a>. Part of the purpose of introducing\nthe <code class=\"docutils literal notranslate\">staticfiles</code> app is to make it easier to keep static files\nseparate from user-uploaded files. Static assets should now go in\n<code class=\"docutils literal notranslate\">static/</code> subdirectories of your apps or in other static assets\ndirectories listed in <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-STATICFILES_DIRS\"><code class=\"xref std std-setting docutils literal notranslate\">STATICFILES_DIRS</code></a>, and will be served\nat <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-STATIC_URL\"><code class=\"xref std std-setting docutils literal notranslate\">STATIC_URL</code></a>.</p>\n<p>See the <a class=\"reference internal\" href=\"/en/dev/ref/contrib/staticfiles/\"><span class=\"doc\">reference documentation of the app</span></a>\nfor more details or learn how to <a class=\"reference internal\" href=\"/en/dev/howto/static-files/\"><span class=\"doc\">manage static files</span></a>.</p>\n</section>\n<section id=\"unittest2-support\">\n<h3><code class=\"docutils literal notranslate\">unittest2</code> support<a class=\"heading-anchor\" href=\"#unittest2-support\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Python 2.7 introduced some major changes to the <code class=\"docutils literal notranslate\">unittest</code> library,\nadding some extremely useful features. To ensure that every Django\nproject can benefit from these new features, Django ships with a copy\nof <a class=\"extlink-pypi reference external\" href=\"https://pypi.org/project/unittest2/\">unittest2</a>, a copy of the Python 2.7 <code class=\"docutils literal notranslate\">unittest</code> library,\nbackported for Python 2.4 compatibility.</p>\n<p>To access this library, Django provides the <code class=\"docutils literal notranslate\">django.utils.unittest</code>\nmodule alias. If you are using Python 2.7, or you have installed\n<code class=\"docutils literal notranslate\">unittest2</code> locally, Django will map the alias to the installed\nversion of the <code class=\"docutils literal notranslate\">unittest</code> library. Otherwise, Django will use its own\nbundled version of <code class=\"docutils literal notranslate\">unittest2</code>.</p>\n<p>To take advantage of this alias, simply use:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.utils</span> <span class=\"kn\">import</span> unittest\n</code></pre></div>\n<p>wherever you would have historically used:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">import</span> <span class=\"nn\">unittest</span>\n</code></pre></div>\n<p>If you want to continue to use the base <code class=\"docutils literal notranslate\">unittest</code> library, you can –\nyou just won’t get any of the nice new <code class=\"docutils literal notranslate\">unittest2</code> features.</p>\n</section>\n<section id=\"transaction-context-managers\">\n<h3>Transaction context managers<a class=\"heading-anchor\" href=\"#transaction-context-managers\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Users of Python 2.5 and above may now use transaction management functions as\ncontext managers. For example:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"k\">with</span> transaction<span class=\"o\">.</span>autocommit<span class=\"p\">():</span>\n    <span class=\"o\">...</span>\n</code></pre></div>\n</section>\n<section id=\"configurable-delete-cascade\">\n<h3>Configurable delete-cascade<a class=\"heading-anchor\" href=\"#configurable-delete-cascade\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ForeignKey\" title=\"django.db.models.ForeignKey\"><code class=\"xref py py-class docutils literal notranslate\">ForeignKey</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.OneToOneField\" title=\"django.db.models.OneToOneField\"><code class=\"xref py py-class docutils literal notranslate\">OneToOneField</code></a> now accept an\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ForeignKey.on_delete\" title=\"django.db.models.ForeignKey.on_delete\"><code class=\"xref py py-attr docutils literal notranslate\">on_delete</code></a> argument to customize behavior\nwhen the referenced object is deleted. Previously, deletes were always\ncascaded; available alternatives now include set null, set default, set to any\nvalue, protect, or do nothing.</p>\n<p>For more information, see the <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ForeignKey.on_delete\" title=\"django.db.models.ForeignKey.on_delete\"><code class=\"xref py py-attr docutils literal notranslate\">on_delete</code></a>\ndocumentation.</p>\n</section>\n<section id=\"contextual-markers-and-comments-for-translatable-strings\">\n<h3>Contextual markers and comments for translatable strings<a class=\"heading-anchor\" href=\"#contextual-markers-and-comments-for-translatable-strings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>For translation strings with ambiguous meaning, you can now\nuse the <code class=\"docutils literal notranslate\">pgettext</code> function to specify the context of the string.</p>\n<p>And if you just want to add some information for translators, you\ncan also add special translator comments in the source.</p>\n<p>For more information, see <a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#contextual-markers\"><span class=\"std std-ref\">Contextual markers</span></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/i18n/translation/#translator-comments\"><span class=\"std std-ref\">Comments for translators</span></a>.</p>\n</section>\n<section id=\"improvements-to-built-in-template-tags\">\n<h3>Improvements to built-in template tags<a class=\"heading-anchor\" href=\"#improvements-to-built-in-template-tags\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>A number of improvements have been made to Django’s built-in template tags:</p>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-include\"><code class=\"xref std std-ttag docutils literal notranslate\">include</code></a> tag now accepts a <code class=\"docutils literal notranslate\">with</code> option, allowing\nyou to specify context variables to the included template</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-include\"><code class=\"xref std std-ttag docutils literal notranslate\">include</code></a> tag now accepts an <code class=\"docutils literal notranslate\">only</code> option, allowing\nyou to exclude the current context from the included context</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-with\"><code class=\"xref std std-ttag docutils literal notranslate\">with</code></a> tag now allows you to define multiple context\nvariables in a single <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-with\"><code class=\"xref std std-ttag docutils literal notranslate\">with</code></a> block.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatetag-load\"><code class=\"xref std std-ttag docutils literal notranslate\">load</code></a> tag now accepts a <code class=\"docutils literal notranslate\">from</code> argument, allowing\nyou to load a single tag or filter from a library.</p></li>\n</ul>\n</section>\n<section id=\"templateresponse\">\n<h3>TemplateResponse<a class=\"heading-anchor\" href=\"#templateresponse\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>It can sometimes be beneficial to allow decorators or middleware to\nmodify a response <em>after</em> it has been constructed by the view. For\nexample, you may want to change the template that is used, or put\nadditional data into the context.</p>\n<p>However, you can’t (easily) modify the content of a basic\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> after it has been constructed. To\novercome this limitation, Django 1.3 adds a new\n<a class=\"reference internal\" href=\"/en/dev/ref/template-response/#django.template.response.TemplateResponse\" title=\"django.template.response.TemplateResponse\"><code class=\"xref py py-class docutils literal notranslate\">TemplateResponse</code></a> class. Unlike basic\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> objects,\n<a class=\"reference internal\" href=\"/en/dev/ref/template-response/#django.template.response.TemplateResponse\" title=\"django.template.response.TemplateResponse\"><code class=\"xref py py-class docutils literal notranslate\">TemplateResponse</code></a> objects retain the details\nof the template and context that was provided by the view to compute\nthe response. The final output of the response is not computed until\nit is needed, later in the response process.</p>\n<p>For more details, see the <a class=\"reference internal\" href=\"/en/dev/ref/template-response/\"><span class=\"doc\">documentation</span></a>\non the <a class=\"reference internal\" href=\"/en/dev/ref/template-response/#django.template.response.TemplateResponse\" title=\"django.template.response.TemplateResponse\"><code class=\"xref py py-class docutils literal notranslate\">TemplateResponse</code></a> class.</p>\n</section>\n<section id=\"caching-changes\">\n<h3>Caching changes<a class=\"heading-anchor\" href=\"#caching-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.3 sees the introduction of several improvements to the\nDjango’s caching infrastructure.</p>\n<p>Firstly, Django now supports multiple named caches. In the same way\nthat Django 1.2 introduced support for multiple database connections,\nDjango 1.3 allows you to use the new <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-CACHES\"><code class=\"xref std std-setting docutils literal notranslate\">CACHES</code></a> setting to\ndefine multiple named cache connections.</p>\n<p>Secondly, <a class=\"reference internal\" href=\"/en/dev/topics/cache/#cache-versioning\"><span class=\"std std-ref\">versioning</span></a>, <a class=\"reference internal\" href=\"/en/dev/topics/cache/#cache-key-prefixing\"><span class=\"std std-ref\">site-wide\nprefixing</span></a> and <a class=\"reference internal\" href=\"/en/dev/topics/cache/#cache-key-transformation\"><span class=\"std std-ref\">transformation</span></a> have been added to the cache API.</p>\n<p>Thirdly, <a class=\"reference internal\" href=\"/en/dev/topics/cache/#using-vary-headers\"><span class=\"std std-ref\">cache key creation</span></a> has been\nupdated to take the request query string into account on <code class=\"docutils literal notranslate\">GET</code>\nrequests.</p>\n<p>Finally, support for <a class=\"reference external\" href=\"http://sendapatch.se/projects/pylibmc/\">pylibmc</a> has been added to the memcached cache\nbackend.</p>\n<p>For more details, see the <a class=\"reference internal\" href=\"/en/dev/topics/cache/\"><span class=\"doc\">documentation on\ncaching in Django</span></a>.</p>\n</section>\n<section id=\"permissions-for-inactive-users\">\n<h3>Permissions for inactive users<a class=\"heading-anchor\" href=\"#permissions-for-inactive-users\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you provide a custom auth backend with <code class=\"docutils literal notranslate\">supports_inactive_user</code>\nset to <code class=\"docutils literal notranslate\">True</code>, an inactive <code class=\"docutils literal notranslate\">User</code> instance will check the backend\nfor permissions. This is useful for further centralizing the\npermission handling. See the <a class=\"reference internal\" href=\"/en/dev/topics/auth/\"><span class=\"doc\">authentication docs</span></a>\nfor more details.</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<p>The GeoDjango test suite is now included when\n<a class=\"reference internal\" href=\"/en/dev/internals/contributing/writing-code/unit-tests/#running-unit-tests\"><span class=\"std std-ref\">running the Django test suite</span></a> with <code class=\"docutils literal notranslate\">runtests.py</code>\nwhen using <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/db-api/#spatial-backends\"><span class=\"std std-ref\">spatial database backends</span></a>.</p>\n</section>\n<section id=\"media-url-and-static-url-must-end-in-a-slash\">\n<h3><a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-MEDIA_URL\"><code class=\"xref std std-setting docutils literal notranslate\">MEDIA_URL</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-STATIC_URL\"><code class=\"xref std std-setting docutils literal notranslate\">STATIC_URL</code></a> must end in a slash<a class=\"heading-anchor\" href=\"#media-url-and-static-url-must-end-in-a-slash\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Previously, the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-MEDIA_URL\"><code class=\"xref std std-setting docutils literal notranslate\">MEDIA_URL</code></a> setting only required a trailing slash if\nit contained a suffix beyond the domain name.</p>\n<p>A trailing slash is now <em>required</em> for <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-MEDIA_URL\"><code class=\"xref std std-setting docutils literal notranslate\">MEDIA_URL</code></a> and the new\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-STATIC_URL\"><code class=\"xref std std-setting docutils literal notranslate\">STATIC_URL</code></a> setting as long as it is not blank. This ensures there is\na consistent way to combine paths in templates.</p>\n<p>Project settings which provide either of both settings without a trailing\nslash will now raise a <code class=\"docutils literal notranslate\">PendingDeprecationWarning</code>.</p>\n<p>In Django 1.4 this same condition will raise <code class=\"docutils literal notranslate\">DeprecationWarning</code>,\nand in Django 1.5 will raise an <code class=\"docutils literal notranslate\">ImproperlyConfigured</code> exception.</p>\n</section>\n<section id=\"everything-else\">\n<h3>Everything else<a class=\"heading-anchor\" href=\"#everything-else\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django <a class=\"reference internal\" href=\"/en/dev/releases/1.1/\"><span class=\"doc\">1.1</span></a> and <a class=\"reference internal\" href=\"/en/dev/releases/1.2/\"><span class=\"doc\">1.2</span></a> added\nlots of big ticket items to Django, like multiple-database support,\nmodel validation, and a session-based messages framework. However,\nthis focus on big features came at the cost of lots of smaller\nfeatures.</p>\n<p>To compensate for this, the focus of the Django 1.3 development\nprocess has been on adding lots of smaller, long standing feature\nrequests. These include:</p>\n<ul class=\"simple\">\n<li><p>Improved tools for accessing and manipulating the current\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/sites/#django.contrib.sites.models.Site\" title=\"django.contrib.sites.models.Site\"><code class=\"xref py py-class docutils literal notranslate\">Site</code></a> object in\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/sites/\"><span class=\"doc\">the sites framework</span></a>.</p></li>\n<li><p>A <a class=\"reference internal\" href=\"/en/dev/topics/testing/advanced/#django.test.RequestFactory\" title=\"django.test.RequestFactory\"><code class=\"xref py py-class docutils literal notranslate\">RequestFactory</code></a> for mocking requests\nin tests.</p></li>\n<li><p>A new test assertion –\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.TransactionTestCase.assertNumQueries\" title=\"django.test.TransactionTestCase.assertNumQueries\"><code class=\"xref py py-meth docutils literal notranslate\">assertNumQueries()</code></a> – making it\neasier to test the database activity associated with a view.</p></li>\n<li><p>Support for lookups spanning relations in admin’s\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter\" title=\"django.contrib.admin.ModelAdmin.list_filter\"><code class=\"xref py py-attr docutils literal notranslate\">list_filter</code></a>.</p></li>\n<li><p>Support for <a class=\"reference external\" href=\"https://owasp.org/www-community/HttpOnly\">HttpOnly</a> cookies.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/email/#django.core.mail.mail_admins\" title=\"django.core.mail.mail_admins\"><code class=\"xref py py-func docutils literal notranslate\">mail_admins()</code></a> and\n<a class=\"reference internal\" href=\"/en/dev/topics/email/#django.core.mail.mail_managers\" title=\"django.core.mail.mail_managers\"><code class=\"xref py py-func docutils literal notranslate\">mail_managers()</code></a> now support easily attaching\nHTML content to messages.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/email/#django.core.mail.EmailMessage\" title=\"django.core.mail.EmailMessage\"><code class=\"xref py py-class docutils literal notranslate\">EmailMessage</code></a> now supports CC’s.</p></li>\n<li><p>Error emails now include more of the detail and formatting of the\ndebug server error page.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/howto/custom-template-tags/#django.template.Library.simple_tag\" title=\"django.template.Library.simple_tag\"><code class=\"xref py py-meth docutils literal notranslate\">simple_tag()</code></a> now accepts a\n<code class=\"docutils literal notranslate\">takes_context</code> argument, making it easier to write simple\ntemplate tags that require access to template context.</p></li>\n<li><p>A new <a class=\"reference internal\" href=\"/en/dev/topics/http/shortcuts/#django.shortcuts.render\" title=\"django.shortcuts.render\"><code class=\"xref py py-meth docutils literal notranslate\">render()</code></a> shortcut – an alternative\nto <code class=\"docutils literal notranslate\">django.shortcuts.render_to_response()</code> providing a\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.RequestContext\" title=\"django.template.RequestContext\"><code class=\"xref py py-class docutils literal notranslate\">RequestContext</code></a> by default.</p></li>\n<li><p>Support for combining <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>\nwith <code class=\"docutils literal notranslate\">timedelta</code> values when retrieving or updating database values.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"backwards-incompatible-changes-in-1-3\">\n<span id=\"backwards-incompatible-changes-1-3\"></span><h2>Backwards-incompatible changes in 1.3<a class=\"heading-anchor\" href=\"#backwards-incompatible-changes-in-1-3\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"csrf-validation-now-applies-to-ajax-requests\">\n<h3>CSRF validation now applies to AJAX requests<a class=\"heading-anchor\" href=\"#csrf-validation-now-applies-to-ajax-requests\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Prior to Django 1.2.5, Django’s CSRF-prevention system exempted AJAX\nrequests from CSRF verification; due to <a class=\"reference external\" href=\"https://www.djangoproject.com/weblog/2011/feb/08/security/\">security issues</a> reported to\nus, however, <em>all</em> requests are now subjected to CSRF\nverification. Consult <a class=\"reference internal\" href=\"/en/dev/ref/csrf/\"><span class=\"doc\">the Django CSRF documentation</span></a> for details on how to handle CSRF verification in\nAJAX requests.</p>\n</section>\n<section id=\"restricted-filters-in-admin-interface\">\n<h3>Restricted filters in admin interface<a class=\"heading-anchor\" href=\"#restricted-filters-in-admin-interface\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Prior to Django 1.2.5, the Django administrative interface allowed\nfiltering on any model field or relation – not just those specified\nin <code class=\"docutils literal notranslate\">list_filter</code> – via query string manipulation. Due to security\nissues reported to us, however, query string lookup arguments in the\nadmin must be for fields or relations specified in <code class=\"docutils literal notranslate\">list_filter</code> or\n<code class=\"docutils literal notranslate\">date_hierarchy</code>.</p>\n</section>\n<section id=\"deleting-a-model-doesn-t-delete-associated-files\">\n<h3>Deleting a model doesn’t delete associated files<a class=\"heading-anchor\" href=\"#deleting-a-model-doesn-t-delete-associated-files\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In earlier Django versions, when a model instance containing a\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\">FileField</code></a> was deleted,\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\">FileField</code></a> took it upon itself to also delete the\nfile from the backend storage. This opened the door to several data-loss\nscenarios, including rolled-back transactions and fields on different models\nreferencing the same file. In Django 1.3, when a model is deleted the\n<a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\">FileField</code></a>’s <code class=\"docutils literal notranslate\">delete()</code> method won’t be called. If\nyou need cleanup of orphaned files, you’ll need to handle it yourself (for\ninstance, with a custom management command that can be run manually or\nscheduled to run periodically via e.g. cron).</p>\n</section>\n<section id=\"passwordinput-default-rendering-behavior\">\n<h3>PasswordInput default rendering behavior<a class=\"heading-anchor\" href=\"#passwordinput-default-rendering-behavior\"><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/widgets/#django.forms.PasswordInput\" title=\"django.forms.PasswordInput\"><code class=\"xref py py-class docutils literal notranslate\">PasswordInput</code></a> form widget, intended for use\nwith form fields which represent passwords, accepts a boolean keyword\nargument <code class=\"docutils literal notranslate\">render_value</code> indicating whether to send its data back to\nthe browser when displaying a submitted form with errors. Prior to\nDjango 1.3, this argument defaulted to <code class=\"docutils literal notranslate\">True</code>, meaning that the\nsubmitted password would be sent back to the browser as part of the\nform. Developers who wished to add a bit of additional security by\nexcluding that value from the redisplayed form could instantiate a\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.PasswordInput\" title=\"django.forms.PasswordInput\"><code class=\"xref py py-class docutils literal notranslate\">PasswordInput</code></a> passing <code class=\"docutils literal notranslate\">render_value=False</code> .</p>\n<p>Due to the sensitive nature of passwords, however, Django 1.3 takes\nthis step automatically; the default value of <code class=\"docutils literal notranslate\">render_value</code> is now\n<code class=\"docutils literal notranslate\">False</code>, and developers who want the password value returned to the\nbrowser on a submission with errors (the previous behavior) must now\nexplicitly indicate this. For example:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"k\">class</span> <span class=\"nc\">LoginForm</span><span class=\"p\">(</span>forms<span class=\"o\">.</span>Form<span class=\"p\">):</span>\n    username <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">(</span>max_length<span class=\"o\">=</span><span class=\"mi\">100</span><span class=\"p\">)</span>\n    password <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">(</span>widget<span class=\"o\">=</span>forms<span class=\"o\">.</span>PasswordInput<span class=\"p\">(</span>render_value<span class=\"o\">=</span><span class=\"kc\">True</span><span class=\"p\">))</span>\n</code></pre></div>\n</section>\n<section id=\"clearable-default-widget-for-filefield\">\n<h3>Clearable default widget for FileField<a class=\"heading-anchor\" href=\"#clearable-default-widget-for-filefield\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.3 now includes a <a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.ClearableFileInput\" title=\"django.forms.ClearableFileInput\"><code class=\"xref py py-class docutils literal notranslate\">ClearableFileInput</code></a> form widget\nin addition to <a class=\"reference internal\" href=\"/en/dev/ref/forms/widgets/#django.forms.FileInput\" title=\"django.forms.FileInput\"><code class=\"xref py py-class docutils literal notranslate\">FileInput</code></a>. <code class=\"docutils literal notranslate\">ClearableFileInput</code> renders\nwith a checkbox to clear the field’s value (if the field has a value and is not\nrequired); <code class=\"docutils literal notranslate\">FileInput</code> provided no means for clearing an existing file from\na <code class=\"docutils literal notranslate\">FileField</code>.</p>\n<p><code class=\"docutils literal notranslate\">ClearableFileInput</code> is now the default widget for a <code class=\"docutils literal notranslate\">FileField</code>, so\nexisting forms including <code class=\"docutils literal notranslate\">FileField</code> without assigning a custom widget will\nneed to account for the possible extra checkbox in the rendered form output.</p>\n<p>To return to the previous rendering (without the ability to clear the\n<code class=\"docutils literal notranslate\">FileField</code>), use the <code class=\"docutils literal notranslate\">FileInput</code> widget in place of\n<code class=\"docutils literal notranslate\">ClearableFileInput</code>. For instance, in a <code class=\"docutils literal notranslate\">ModelForm</code> for a hypothetical\n<code class=\"docutils literal notranslate\">Document</code> model with a <code class=\"docutils literal notranslate\">FileField</code> named <code class=\"docutils literal notranslate\">document</code>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django</span> <span class=\"kn\">import</span> forms\n<span class=\"kn\">from</span> <span class=\"nn\">myapp.models</span> <span class=\"kn\">import</span> Document\n\n\n<span class=\"k\">class</span> <span class=\"nc\">DocumentForm</span><span class=\"p\">(</span>forms<span class=\"o\">.</span>ModelForm<span class=\"p\">):</span>\n    <span class=\"k\">class</span> <span class=\"nc\">Meta</span><span class=\"p\">:</span>\n        model <span class=\"o\">=</span> Document\n        widgets <span class=\"o\">=</span> <span class=\"p\">{</span><span class=\"s2\">&quot;document&quot;</span><span class=\"p\">:</span> forms<span class=\"o\">.</span>FileInput<span class=\"p\">}</span>\n</code></pre></div>\n</section>\n<section id=\"new-index-on-database-session-table\">\n<h3>New index on database session table<a class=\"heading-anchor\" href=\"#new-index-on-database-session-table\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Prior to Django 1.3, the database table used by the database backend\nfor the <a class=\"reference internal\" href=\"/en/dev/topics/http/sessions/\"><span class=\"doc\">sessions</span></a> app had no index on\nthe <code class=\"docutils literal notranslate\">expire_date</code> column. As a result, date-based queries on the\nsession table – such as the query that is needed to purge old\nsessions – would be very slow if there were lots of sessions.</p>\n<p>If you have an existing project that is using the database session\nbackend, you don’t have to do anything to accommodate this change.\nHowever, you may get a significant performance boost if you manually\nadd the new index to the session table. The SQL that will add the\nindex can be found by running the <code class=\"docutils literal notranslate\">sqlindexes</code> admin command:</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</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=\"Shell code\"><code>python manage.py sqlindexes sessions\n</code></pre></div>\n</section>\n<section id=\"no-more-naughty-words\">\n<h3>No more naughty words<a class=\"heading-anchor\" href=\"#no-more-naughty-words\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django has historically provided (and enforced) a list of profanities.\nThe comments app has enforced this list of profanities, preventing people from\nsubmitting comments that contained one of those profanities.</p>\n<p>Unfortunately, the technique used to implement this profanities list\nwas woefully naive, and prone to the <a class=\"reference external\" href=\"https://en.wikipedia.org/wiki/Scunthorpe_problem\">Scunthorpe problem</a>. Improving\nthe built-in filter to fix this problem would require significant\neffort, and since natural language processing isn’t the normal domain\nof a web framework, we have “fixed” the problem by making the list of\nprohibited words an empty list.</p>\n<p>If you want to restore the old behavior, simply put a\n<code class=\"docutils literal notranslate\">PROFANITIES_LIST</code> setting in your settings file that includes the\nwords that you want to prohibit (see the <a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/edd767d2612d891a906268cf590571f541dd164f\">commit that implemented this\nchange</a> if you want to see the list\nof words that was historically prohibited). However, if avoiding profanities is\nimportant to you, you would be well advised to seek out a better, less naive\napproach to the problem.</p>\n</section>\n<section id=\"localflavor-changes\">\n<h3>Localflavor changes<a class=\"heading-anchor\" href=\"#localflavor-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django 1.3 introduces the following backwards-incompatible changes to\nlocal flavors:</p>\n<ul class=\"simple\">\n<li><p>Canada (ca) – The province “Newfoundland and Labrador” has had its\nprovince code updated to “NL”, rather than the older “NF”. In\naddition, the Yukon Territory has had its province code corrected to\n“YT”, instead of “YK”.</p></li>\n<li><p>Indonesia (id) – The province “Nanggroe Aceh Darussalam (NAD)” has\nbeen removed from the province list in favor of the new official\ndesignation “Aceh (ACE)”.</p></li>\n<li><p>United States of America (us) – The list of “states” used by\n<code class=\"docutils literal notranslate\">USStateField</code> has expanded to include Armed Forces postal\ncodes. This is backwards-incompatible if you were relying on\n<code class=\"docutils literal notranslate\">USStateField</code> not including them.</p></li>\n</ul>\n</section>\n<section id=\"formset-updates\">\n<h3>FormSet updates<a class=\"heading-anchor\" href=\"#formset-updates\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In Django 1.3 <code class=\"docutils literal notranslate\">FormSet</code> creation behavior is modified slightly. Historically\nthe class didn’t make a distinction between not being passed data and being\npassed empty dictionary. This was inconsistent with behavior in other parts of\nthe framework. Starting with 1.3 if you pass in empty dictionary the\n<code class=\"docutils literal notranslate\">FormSet</code> will raise a <code class=\"docutils literal notranslate\">ValidationError</code>.</p>\n<p>For example with a <code class=\"docutils literal notranslate\">FormSet</code>:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"k\">class</span> <span class=\"nc\">ArticleForm</span><span class=\"p\">(</span>Form<span class=\"p\">):</span>\n<span class=\"gp\">... </span>    title <span class=\"o\">=</span> CharField<span class=\"p\">()</span>\n<span class=\"gp\">... </span>    pub_date <span class=\"o\">=</span> DateField<span class=\"p\">()</span>\n<span class=\"gp\">...</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>ArticleFormSet <span class=\"o\">=</span> formset_factory<span class=\"p\">(</span>ArticleForm<span class=\"p\">)</span>\n</code></pre></div>\n<p>the following code will raise a <code class=\"docutils literal notranslate\">ValidationError</code>:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>ArticleFormSet<span class=\"p\">({})</span>\n<span class=\"gt\">Traceback (most recent call last):</span>\n<span class=\"c\">...</span>\n<span class=\"gr\">ValidationError</span>: [u&#39;ManagementForm data is missing or has been tampered with&#39;]\n</code></pre></div>\n<p>if you need to instantiate an empty <code class=\"docutils literal notranslate\">FormSet</code>, don’t pass in the data or use\n<code class=\"docutils literal notranslate\">None</code>:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>formset <span class=\"o\">=</span> ArticleFormSet<span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>formset <span class=\"o\">=</span> ArticleFormSet<span class=\"p\">(</span>data<span class=\"o\">=</span><span class=\"kc\">None</span><span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"callables-in-templates\">\n<h3>Callables in templates<a class=\"heading-anchor\" href=\"#callables-in-templates\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Previously, a callable in a template would only be called automatically as part\nof the variable resolution process if it was retrieved via attribute\nlookup. This was an inconsistency that could result in confusing and unhelpful\nbehavior:</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>Template<span class=\"p\">(</span><span class=\"s2\">&quot;{{ user.get_full_name }}&quot;</span><span class=\"p\">)</span><span class=\"o\">.</span>render<span class=\"p\">(</span>Context<span class=\"p\">({</span><span class=\"s2\">&quot;user&quot;</span><span class=\"p\">:</span> user<span class=\"p\">}))</span>\n<span class=\"go\">u&#39;Joe Bloggs&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>Template<span class=\"p\">(</span><span class=\"s2\">&quot;{{ full_name }}&quot;</span><span class=\"p\">)</span><span class=\"o\">.</span>render<span class=\"p\">(</span>Context<span class=\"p\">({</span><span class=\"s2\">&quot;full_name&quot;</span><span class=\"p\">:</span> user<span class=\"o\">.</span>get_full_name<span class=\"p\">}))</span>\n<span class=\"go\">u&#39;&amp;lt;bound method User.get_full_name of &amp;lt;...</span>\n</code></pre></div>\n<p>This has been resolved in Django 1.3 - the result in both cases will be <code class=\"docutils literal notranslate\">u'Joe\nBloggs'</code>. Although the previous behavior was not useful for a template\nlanguage designed for web designers, and was never deliberately supported, it\nis possible that some templates may be broken by this change.</p>\n</section>\n<section id=\"use-of-custom-sql-to-load-initial-data-in-tests\">\n<h3>Use of custom SQL to load initial data in tests<a class=\"heading-anchor\" href=\"#use-of-custom-sql-to-load-initial-data-in-tests\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django provides a custom SQL hooks as a way to inject hand-crafted SQL\ninto the database synchronization process. One of the possible uses\nfor this custom SQL is to insert data into your database. If your\ncustom SQL contains <code class=\"docutils literal notranslate\">INSERT</code> statements, those insertions will be\nperformed every time your database is synchronized. This includes the\nsynchronization of any test databases that are created when you run a\ntest suite.</p>\n<p>However, in the process of testing the Django 1.3, it was discovered\nthat this feature has never completely worked as advertised. When\nusing database backends that don’t support transactions, or when using\na TransactionTestCase, data that has been inserted using custom SQL\nwill not be visible during the testing process.</p>\n<p>Unfortunately, there was no way to rectify this problem without\nintroducing a backwards incompatibility. Rather than leave\nSQL-inserted initial data in an uncertain state, Django now enforces\nthe policy that data inserted by custom SQL will <em>not</em> be visible\nduring testing.</p>\n<p>This change only affects the testing process. You can still use custom\nSQL to load data into your production database as part of the <code class=\"docutils literal notranslate\">syncdb</code>\nprocess. If you require data to exist during test conditions, you\nshould either insert it using <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#topics-testing-fixtures\"><span class=\"std std-ref\">test fixtures</span></a>, or using the <code class=\"docutils literal notranslate\">setUp()</code> method of your\ntest case.</p>\n</section>\n<section id=\"changed-priority-of-translation-loading\">\n<h3>Changed priority of translation loading<a class=\"heading-anchor\" href=\"#changed-priority-of-translation-loading\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Work has been done to simplify, rationalize and properly document the algorithm\nused by Django at runtime to build translations from the different translations\nfound on disk, namely:</p>\n<p>For translatable literals found in Python code and templates (<code class=\"docutils literal notranslate\">'django'</code>\ngettext domain):</p>\n<ul class=\"simple\">\n<li><p>Priorities of translations included with applications listed in the\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> setting were changed. To provide a behavior\nconsistent with other parts of Django that also use such setting (templates,\netc.) now, when building the translation that will be made available, the\napps listed first have higher precedence than the ones listed later.</p></li>\n<li><p>Now it is possible to override the translations shipped with applications by\nusing the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOCALE_PATHS\"><code class=\"xref std std-setting docutils literal notranslate\">LOCALE_PATHS</code></a> setting whose translations have now higher\nprecedence than the translations of <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> applications.\nThe relative priority among the values listed in this setting has also been\nmodified so the paths listed first have higher precedence than the\nones listed later.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">locale</code> subdirectory of the directory containing the settings, that\nusually coincides with and is known as the <em>project directory</em> is being\ndeprecated in this release as a source of translations. (the precedence of\nthese translations is intermediate between applications and\n<a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOCALE_PATHS\"><code class=\"xref std std-setting docutils literal notranslate\">LOCALE_PATHS</code></a> translations). See the <a class=\"reference internal\" href=\"#loading-of-project-level-translations\">corresponding deprecated\nfeatures section</a> of this document.</p></li>\n</ul>\n<p>For translatable literals found in JavaScript code (<code class=\"docutils literal notranslate\">'djangojs'</code> gettext\ndomain):</p>\n<ul class=\"simple\">\n<li><p>Similarly to the <code class=\"docutils literal notranslate\">'django'</code> domain translations: Overriding of\ntranslations shipped with applications by using the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOCALE_PATHS\"><code class=\"xref std std-setting docutils literal notranslate\">LOCALE_PATHS</code></a>\nsetting is now possible for this domain too. These translations have higher\nprecedence than the translations of Python packages passed to the\n<code class=\"docutils literal notranslate\">javascript_catalog()</code> view. Paths listed first have higher precedence than\nthe ones listed later.</p></li>\n<li><p>Translations under the <code class=\"docutils literal notranslate\">locale</code> subdirectory of the <em>project directory</em>\nhave never been taken in account for JavaScript translations and remain in\nthe same situation considering the deprecation of such location.</p></li>\n</ul>\n</section>\n<section id=\"transaction-management\">\n<h3>Transaction management<a class=\"heading-anchor\" href=\"#transaction-management\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>When using managed transactions – that is, anything but the default\nautocommit mode – it is important when a transaction is marked as\n“dirty”. Dirty transactions are committed by the <code class=\"docutils literal notranslate\">commit_on_success</code>\ndecorator or the <code class=\"docutils literal notranslate\">django.middleware.transaction.TransactionMiddleware</code>, and\n<code class=\"docutils literal notranslate\">commit_manually</code> forces them to be closed explicitly; clean transactions\n“get a pass”, which means they are usually rolled back at the end of a request\nwhen the connection is closed.</p>\n<p>Until Django 1.3, transactions were only marked dirty when Django was\naware of a modifying operation performed in them; that is, either some\nmodel was saved, some bulk update or delete was performed, or the user\nexplicitly called <code class=\"docutils literal notranslate\">transaction.set_dirty()</code>. In Django 1.3, a\ntransaction is marked dirty when <em>any</em> database operation is\nperformed.</p>\n<p>As a result of this change, you no longer need to set a transaction\ndirty explicitly when you execute raw SQL or use a data-modifying\n<code class=\"docutils literal notranslate\">SELECT</code>. However, you <em>do</em> need to explicitly close any read-only\ntransactions that are being managed using <code class=\"docutils literal notranslate\">commit_manually()</code>. For example:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"nd\">@transaction</span><span class=\"o\">.</span>commit_manually\n<span class=\"k\">def</span> <span class=\"nf\">my_view</span><span class=\"p\">(</span>request<span class=\"p\">,</span> name<span class=\"p\">):</span>\n    obj <span class=\"o\">=</span> get_object_or_404<span class=\"p\">(</span>MyObject<span class=\"p\">,</span> name__iexact<span class=\"o\">=</span>name<span class=\"p\">)</span>\n    <span class=\"k\">return</span> render_to_response<span class=\"p\">(</span><span class=\"s2\">&quot;template&quot;</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"s2\">&quot;object&quot;</span><span class=\"p\">:</span> obj<span class=\"p\">})</span>\n</code></pre></div>\n<p>Prior to Django 1.3, this would work without error. However, under\nDjango 1.3, this will raise a\n<a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.db.transaction.TransactionManagementError\" title=\"django.db.transaction.TransactionManagementError\"><code class=\"xref py py-class docutils literal notranslate\">TransactionManagementError</code></a> because\nthe read operation that retrieves the <code class=\"docutils literal notranslate\">MyObject</code> instance leaves the\ntransaction in a dirty state.</p>\n</section>\n<section id=\"no-password-reset-for-inactive-users\">\n<h3>No password reset for inactive users<a class=\"heading-anchor\" href=\"#no-password-reset-for-inactive-users\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Prior to Django 1.3, inactive users were able to request a password reset email\nand reset their password. In Django 1.3 inactive users will receive the same\nmessage as a nonexistent account.</p>\n</section>\n<section id=\"password-reset-view-now-accepts-from-email\">\n<h3>Password reset view now accepts <code class=\"docutils literal notranslate\">from_email</code><a class=\"heading-anchor\" href=\"#password-reset-view-now-accepts-from-email\"><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.contrib.auth.views.password_reset()</code> view now accepts a\n<code class=\"docutils literal notranslate\">from_email</code> parameter, which is passed to the <code class=\"docutils literal notranslate\">password_reset_form</code>’s\n<code class=\"docutils literal notranslate\">save()</code> method as a keyword argument. If you are using this view with a\ncustom password reset form, then you will need to ensure your form’s <code class=\"docutils literal notranslate\">save()</code>\nmethod accepts this keyword argument.</p>\n</section>\n</section>\n<section id=\"features-deprecated-in-1-3\">\n<span id=\"deprecated-features-1-3\"></span><h2>Features deprecated in 1.3<a class=\"heading-anchor\" href=\"#features-deprecated-in-1-3\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django 1.3 deprecates some features from earlier releases.\nThese features are still supported, but will be gradually phased out\nover the next few release cycles.</p>\n<p>Code taking advantage of any of the features below will raise a\n<code class=\"docutils literal notranslate\">PendingDeprecationWarning</code> in Django 1.3. This warning will be\nsilent by default, but may be turned on using Python’s <a class=\"reference external\" href=\"https://docs.python.org/3/library/warnings.html#module-warnings\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">warnings</code></a>\nmodule, or by running Python with a <code class=\"docutils literal notranslate\">-Wd</code> or <code class=\"docutils literal notranslate\">-Wall</code> flag.</p>\n<p>In Django 1.4, these warnings will become a <code class=\"docutils literal notranslate\">DeprecationWarning</code>,\nwhich is <em>not</em> silent. In Django 1.5 support for these features will\nbe removed entirely.</p>\n<aside class=\"admonition admonition-seealso\" role=\"note\">\n<p class=\"admonition-title\">See also</p>\n<p>For more details, see the documentation <a class=\"reference internal\" href=\"/en/dev/internals/release-process/\"><span class=\"doc\">Django’s release process</span></a> and our <a class=\"reference internal\" href=\"/en/dev/internals/deprecation/\"><span class=\"doc\">deprecation timeline</span></a>.</p>\n</aside>\n<section id=\"mod-python-support\">\n<h3><code class=\"docutils literal notranslate\">mod_python</code> support<a class=\"heading-anchor\" href=\"#mod-python-support\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">mod_python</code> library has not had a release since 2007 or a commit since\n2008. The Apache Foundation board voted to remove <code class=\"docutils literal notranslate\">mod_python</code> from the set\nof active projects in its version control repositories, and its lead developer\nhas shifted all of his efforts toward the lighter, slimmer, more stable, and\nmore flexible <code class=\"docutils literal notranslate\">mod_wsgi</code> backend.</p>\n<p>If you are currently using the <code class=\"docutils literal notranslate\">mod_python</code> request handler, you\nshould redeploy your Django projects using another request handler.\n<a class=\"reference internal\" href=\"/en/dev/howto/deployment/wsgi/modwsgi/\"><span class=\"doc\">mod_wsgi</span></a> is the request handler\nrecommended by the Django project, but FastCGI is also supported. Support for\n<code class=\"docutils literal notranslate\">mod_python</code> deployment will be removed in Django 1.5.</p>\n</section>\n<section id=\"function-based-generic-views\">\n<h3>Function-based generic views<a class=\"heading-anchor\" href=\"#function-based-generic-views\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>As a result of the introduction of class-based generic views, the\nfunction-based generic views provided by Django have been deprecated.\nThe following modules and the views they contain have been deprecated:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.views.generic.create_update</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.views.generic.date_based</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.views.generic.list_detail</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.views.generic.simple</code></p></li>\n</ul>\n</section>\n<section id=\"test-client-response-template-attribute\">\n<h3>Test client response <code class=\"docutils literal notranslate\">template</code> attribute<a class=\"heading-anchor\" href=\"#test-client-response-template-attribute\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django’s <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#test-client\"><span class=\"std std-ref\">test client</span></a> returns\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.Response\" title=\"django.test.Response\"><code class=\"xref py py-class docutils literal notranslate\">Response</code></a> objects annotated with extra testing\ninformation. In Django versions prior to 1.3, this included a <code class=\"docutils literal notranslate\">template</code>\nattribute containing information about templates rendered in generating the\nresponse: either None, a single <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Template\" title=\"django.template.Template\"><code class=\"xref py py-class docutils literal notranslate\">Template</code></a> object, or a\nlist of <a class=\"reference internal\" href=\"/en/dev/ref/templates/api/#django.template.Template\" title=\"django.template.Template\"><code class=\"xref py py-class docutils literal notranslate\">Template</code></a> objects. This inconsistency in\nreturn values (sometimes a list, sometimes not) made the attribute difficult\nto work with.</p>\n<p>In Django 1.3 the <code class=\"docutils literal notranslate\">template</code> attribute is deprecated in favor of a new\n<a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.Response.templates\" title=\"django.test.Response.templates\"><code class=\"xref py py-attr docutils literal notranslate\">templates</code></a> attribute, which is always a\nlist, even if it has only a single element or no elements.</p>\n</section>\n<section id=\"djangotestrunner\">\n<h3><code class=\"docutils literal notranslate\">DjangoTestRunner</code><a class=\"heading-anchor\" href=\"#djangotestrunner\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>As a result of the introduction of support for <code class=\"docutils literal notranslate\">unittest2</code>, the features\nof <code class=\"docutils literal notranslate\">django.test.simple.DjangoTestRunner</code> (including fail-fast\nand Ctrl-C test termination) have been made redundant. In view of this\nredundancy, <code class=\"docutils literal notranslate\">DjangoTestRunner</code> has been turned into an empty placeholder\nclass, and will be removed entirely in Django 1.5.</p>\n</section>\n<section id=\"changes-to-url-and-ssi\">\n<h3>Changes to <code class=\"docutils literal notranslate\">url</code> and <code class=\"docutils literal notranslate\">ssi</code><a class=\"heading-anchor\" href=\"#changes-to-url-and-ssi\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Most template tags will allow you to pass in either constants or\nvariables as arguments – for example:</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\">extends</span> <span class=\"s2\">&quot;base.html&quot;</span> <span class=\"cp\">%}</span>\n</code></pre></div>\n<p>allows you to specify a base template as a constant, but if you have a\ncontext variable <code class=\"docutils literal notranslate\">templ</code> that contains the value <code class=\"docutils literal notranslate\">base.html</code>:</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\">extends</span> <span class=\"nv\">templ</span> <span class=\"cp\">%}</span>\n</code></pre></div>\n<p>is also legal.</p>\n<p>However, due to an accident of history, the <code class=\"docutils literal notranslate\">url</code> and <code class=\"docutils literal notranslate\">ssi</code> are different.\nThese tags use the second, quoteless syntax, but interpret the argument as a\nconstant. This means it isn’t possible to use a context variable as the target\nof a <code class=\"docutils literal notranslate\">url</code> and <code class=\"docutils literal notranslate\">ssi</code> tag.</p>\n<p>Django 1.3 marks the start of the process to correct this historical\naccident. Django 1.3 adds a new template library – <code class=\"docutils literal notranslate\">future</code> – that\nprovides alternate implementations of the <code class=\"docutils literal notranslate\">url</code> and <code class=\"docutils literal notranslate\">ssi</code>\ntemplate tags. This <code class=\"docutils literal notranslate\">future</code> library implement behavior that makes\nthe handling of the first argument consistent with the handling of all\nother variables. So, an existing template that contains:</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\">url</span> <span class=\"nv\">sample</span> <span class=\"cp\">%}</span>\n</code></pre></div>\n<p>should be replaced with:</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\">load</span> <span class=\"nv\">url</span> <span class=\"nv\">from</span> <span class=\"nv\">future</span> <span class=\"cp\">%}</span>\n<span class=\"cp\">{%</span> <span class=\"k\">url</span> <span class=\"s1\">&#39;sample&#39;</span> <span class=\"cp\">%}</span>\n</code></pre></div>\n<p>The tags implementing the old behavior have been deprecated, and in\nDjango 1.5, the old behavior will be replaced with the new behavior.\nTo ensure compatibility with future versions of Django, existing\ntemplates should be modified to use the new <code class=\"docutils literal notranslate\">future</code> libraries and\nsyntax.</p>\n</section>\n<section id=\"changes-to-the-login-methods-of-the-admin\">\n<h3>Changes to the login methods of the admin<a class=\"heading-anchor\" href=\"#changes-to-the-login-methods-of-the-admin\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In previous version the admin app defined login methods in multiple locations\nand ignored the almost identical implementation in the already used auth app.\nA side effect of this duplication was the missing adoption of the changes made\nin <a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/c8015052d935a99a5c8f96434b2d0cd16d8a4e14\">r12634</a> to support a\nbroader set of characters for usernames.</p>\n<p>This release refactors the admin’s login mechanism to use a subclass of the\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/default/#django.contrib.auth.forms.AuthenticationForm\" title=\"django.contrib.auth.forms.AuthenticationForm\"><code class=\"xref py py-class docutils literal notranslate\">AuthenticationForm</code></a> instead of a manual\nform validation. The previously undocumented method\n<code class=\"docutils literal notranslate\">'django.contrib.admin.sites.AdminSite.display_login_form'</code> has been removed\nin favor of a new <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#django.contrib.admin.AdminSite.login_form\" title=\"django.contrib.admin.AdminSite.login_form\"><code class=\"xref py py-attr docutils literal notranslate\">login_form</code></a>\nattribute.</p>\n</section>\n<section id=\"reset-and-sqlreset-management-commands\">\n<h3><code class=\"docutils literal notranslate\">reset</code> and <code class=\"docutils literal notranslate\">sqlreset</code> management commands<a class=\"heading-anchor\" href=\"#reset-and-sqlreset-management-commands\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Those commands have been deprecated. The <code class=\"docutils literal notranslate\">flush</code> and <code class=\"docutils literal notranslate\">sqlflush</code> commands\ncan be used to delete everything. You can also use ALTER TABLE or DROP TABLE\nstatements manually.</p>\n</section>\n<section id=\"id1\">\n<h3>GeoDjango<a class=\"heading-anchor\" href=\"#id1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>The function-based <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-TEST_RUNNER\"><code class=\"xref std std-setting docutils literal notranslate\">TEST_RUNNER</code></a> previously used to execute\nthe GeoDjango test suite, <code class=\"docutils literal notranslate\">django.contrib.gis.tests.run_gis_tests</code>, was\ndeprecated for the class-based runner,\n<code class=\"docutils literal notranslate\">django.contrib.gis.tests.GeoDjangoTestSuiteRunner</code>.</p></li>\n<li><p>Previously, calling\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.transform\" title=\"django.contrib.gis.geos.GEOSGeometry.transform\"><code class=\"xref py py-meth docutils literal notranslate\">transform()</code></a> would\nsilently do nothing when GDAL wasn’t available. Now, a\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSException\" title=\"django.contrib.gis.geos.GEOSException\"><code class=\"xref py py-class docutils literal notranslate\">GEOSException</code></a> is properly raised\nto indicate possible faulty application code. A warning is now\nraised if <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.transform\" title=\"django.contrib.gis.geos.GEOSGeometry.transform\"><code class=\"xref py py-meth docutils literal notranslate\">transform()</code></a> is\ncalled when the SRID of the geometry is less than 0 or <code class=\"docutils literal notranslate\">None</code>.</p></li>\n</ul>\n</section>\n<section id=\"czbirthnumberfield-clean\">\n<h3><code class=\"docutils literal notranslate\">CZBirthNumberField.clean</code><a class=\"heading-anchor\" href=\"#czbirthnumberfield-clean\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Previously this field’s <code class=\"docutils literal notranslate\">clean()</code> method accepted a second, gender, argument\nwhich allowed stronger validation checks to be made, however since this\nargument could never actually be passed from the Django form machinery it is\nnow pending deprecation.</p>\n</section>\n<section id=\"compatcookie\">\n<h3><code class=\"docutils literal notranslate\">CompatCookie</code><a class=\"heading-anchor\" href=\"#compatcookie\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Previously, <code class=\"docutils literal notranslate\">django.http</code> exposed an undocumented <code class=\"docutils literal notranslate\">CompatCookie</code> class,\nwhich was a bugfix wrapper around the standard library <code class=\"docutils literal notranslate\">SimpleCookie</code>. As the\nfixes are moving upstream, this is now deprecated - you should use <code class=\"docutils literal notranslate\">from\ndjango.http import SimpleCookie</code> instead.</p>\n</section>\n<section id=\"loading-of-project-level-translations\">\n<span id=\"id2\"></span><h3>Loading of <em>project-level</em> translations<a class=\"heading-anchor\" href=\"#loading-of-project-level-translations\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>This release of Django starts the deprecation process for inclusion of\ntranslations located under the so-called <em>project path</em> in the translation\nbuilding process performed at runtime. The <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-LOCALE_PATHS\"><code class=\"xref std std-setting docutils literal notranslate\">LOCALE_PATHS</code></a> setting can\nbe used for the same task by adding the filesystem path to a <code class=\"docutils literal notranslate\">locale</code>\ndirectory containing project-level translations to the value of that setting.</p>\n<p>Rationale for this decision:</p>\n<ul>\n<li><p>The <em>project path</em> has always been a loosely defined concept\n(actually, the directory used for locating project-level\ntranslations is the directory containing the settings module) and\nthere has been a shift in other parts of the framework to stop using\nit as a reference for location of assets at runtime.</p></li>\n<li><p>Detection of the <code class=\"docutils literal notranslate\">locale</code> subdirectory tends to fail when the\ndeployment scenario is more complex than the basic one. e.g. it\nfails when the settings module is a directory (ticket #10765).</p></li>\n<li><p>There are potential strange development- and deployment-time\nproblems like the fact that the <code class=\"docutils literal notranslate\">project_dir/locale/</code> subdir can\ngenerate spurious error messages when the project directory is added\nto the Python path (<code class=\"docutils literal notranslate\">manage.py runserver</code> does this) and then it\nclashes with the equally named standard library module, this is a\ntypical warning message:</p>\n<div class=\"code-block\" data-language=\"pytb\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Pytb</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=\"Pytb code\"><code><span class=\"x\">/usr/lib/python2.6/gettext.py:49: ImportWarning: Not importing directory &#39;/path/to/project/locale&#39;: missing __init__.py.</span>\n<span class=\"x\">import locale, copy, os, re, struct, sys</span>\n</code></pre></div>\n</li>\n<li><p>This location wasn’t included in the translation building process\nfor JavaScript literals. This deprecation removes such\ninconsistency.</p></li>\n</ul>\n</section>\n<section id=\"permwrapper-moved-to-django-contrib-auth-context-processors\">\n<h3><code class=\"docutils literal notranslate\">PermWrapper</code> moved to <code class=\"docutils literal notranslate\">django.contrib.auth.context_processors</code><a class=\"heading-anchor\" href=\"#permwrapper-moved-to-django-contrib-auth-context-processors\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In Django 1.2, we began the process of changing the location of the\n<code class=\"docutils literal notranslate\">auth</code> context processor from <code class=\"docutils literal notranslate\">django.core.context_processors</code> to\n<code class=\"docutils literal notranslate\">django.contrib.auth.context_processors</code>. However, the\n<code class=\"docutils literal notranslate\">PermWrapper</code> support class was mistakenly omitted from that\nmigration. In Django 1.3, the <code class=\"docutils literal notranslate\">PermWrapper</code> class has also been\nmoved to <code class=\"docutils literal notranslate\">django.contrib.auth.context_processors</code>, along with the\n<code class=\"docutils literal notranslate\">PermLookupDict</code> support class. The new classes are functionally\nidentical to their old versions; only the module location has changed.</p>\n</section>\n<section id=\"removal-of-xmlfield\">\n<h3>Removal of <code class=\"docutils literal notranslate\">XMLField</code><a class=\"heading-anchor\" href=\"#removal-of-xmlfield\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>When Django was first released, Django included an <code class=\"docutils literal notranslate\">XMLField</code> that performed\nautomatic XML validation for any field input. However, this validation function\nhasn’t been performed since the introduction of <code class=\"docutils literal notranslate\">newforms</code>, prior to the 1.0\nrelease. As a result, <code class=\"docutils literal notranslate\">XMLField</code> as currently implemented is functionally\nindistinguishable from a simple <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.TextField\" title=\"django.db.models.TextField\"><code class=\"xref py py-class docutils literal notranslate\">TextField</code></a>.</p>\n<p>For this reason, Django 1.3 has fast-tracked the deprecation of\n<code class=\"docutils literal notranslate\">XMLField</code> – instead of a two-release deprecation, <code class=\"docutils literal notranslate\">XMLField</code>\nwill be removed entirely in Django 1.4.</p>\n<p>It’s easy to update your code to accommodate this change – just\nreplace all uses of <code class=\"docutils literal notranslate\">XMLField</code> with <code class=\"docutils literal notranslate\">TextField</code>, and remove the\n<code class=\"docutils literal notranslate\">schema_path</code> keyword argument (if it is specified).</p>\n</section>\n</section>","rootId":"django-1-3-release-notes","toc":[{"title":"Overview","anchor":"overview","children":[]},{"title":"Python compatibility","anchor":"python-compatibility","children":[]},{"title":"What’s new in Django 1.3","anchor":"what-s-new-in-django-1-3","children":[{"title":"Class-based views","anchor":"class-based-views","children":[]},{"title":"Logging","anchor":"logging","children":[]},{"title":"Extended static files handling","anchor":"extended-static-files-handling","children":[]},{"title":"unittest2 support","anchor":"unittest2-support","children":[]},{"title":"Transaction context managers","anchor":"transaction-context-managers","children":[]},{"title":"Configurable delete-cascade","anchor":"configurable-delete-cascade","children":[]},{"title":"Contextual markers and comments for translatable strings","anchor":"contextual-markers-and-comments-for-translatable-strings","children":[]},{"title":"Improvements to built-in template tags","anchor":"improvements-to-built-in-template-tags","children":[]},{"title":"TemplateResponse","anchor":"templateresponse","children":[]},{"title":"Caching changes","anchor":"caching-changes","children":[]},{"title":"Permissions for inactive users","anchor":"permissions-for-inactive-users","children":[]},{"title":"GeoDjango","anchor":"geodjango","children":[]},{"title":"MEDIA_URL and STATIC_URL must end in a slash","anchor":"media-url-and-static-url-must-end-in-a-slash","children":[]},{"title":"Everything else","anchor":"everything-else","children":[]}]},{"title":"Backwards-incompatible changes in 1.3","anchor":"backwards-incompatible-changes-in-1-3","children":[{"title":"CSRF validation now applies to AJAX requests","anchor":"csrf-validation-now-applies-to-ajax-requests","children":[]},{"title":"Restricted filters in admin interface","anchor":"restricted-filters-in-admin-interface","children":[]},{"title":"Deleting a model doesn’t delete associated files","anchor":"deleting-a-model-doesn-t-delete-associated-files","children":[]},{"title":"PasswordInput default rendering behavior","anchor":"passwordinput-default-rendering-behavior","children":[]},{"title":"Clearable default widget for FileField","anchor":"clearable-default-widget-for-filefield","children":[]},{"title":"New index on database session table","anchor":"new-index-on-database-session-table","children":[]},{"title":"No more naughty words","anchor":"no-more-naughty-words","children":[]},{"title":"Localflavor changes","anchor":"localflavor-changes","children":[]},{"title":"FormSet updates","anchor":"formset-updates","children":[]},{"title":"Callables in templates","anchor":"callables-in-templates","children":[]},{"title":"Use of custom SQL to load initial data in tests","anchor":"use-of-custom-sql-to-load-initial-data-in-tests","children":[]},{"title":"Changed priority of translation loading","anchor":"changed-priority-of-translation-loading","children":[]},{"title":"Transaction management","anchor":"transaction-management","children":[]},{"title":"No password reset for inactive users","anchor":"no-password-reset-for-inactive-users","children":[]},{"title":"Password reset view now accepts from_email","anchor":"password-reset-view-now-accepts-from-email","children":[]}]},{"title":"Features deprecated in 1.3","anchor":"features-deprecated-in-1-3","children":[{"title":"mod_python support","anchor":"mod-python-support","children":[]},{"title":"Function-based generic views","anchor":"function-based-generic-views","children":[]},{"title":"Test client response template attribute","anchor":"test-client-response-template-attribute","children":[]},{"title":"DjangoTestRunner","anchor":"djangotestrunner","children":[]},{"title":"Changes to url and ssi","anchor":"changes-to-url-and-ssi","children":[]},{"title":"Changes to the login methods of the admin","anchor":"changes-to-the-login-methods-of-the-admin","children":[]},{"title":"reset and sqlreset management commands","anchor":"reset-and-sqlreset-management-commands","children":[]},{"title":"GeoDjango","anchor":"id1","children":[]},{"title":"CZBirthNumberField.clean","anchor":"czbirthnumberfield-clean","children":[]},{"title":"CompatCookie","anchor":"compatcookie","children":[]},{"title":"Loading of project-level translations","anchor":"loading-of-project-level-translations","children":[]},{"title":"PermWrapper moved to django.contrib.auth.context_processors","anchor":"permwrapper-moved-to-django-contrib-auth-context-processors","children":[]},{"title":"Removal of XMLField","anchor":"removal-of-xmlfield","children":[]}]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.3.1","title":"Django 1.3.1 release notes","url":"/en/dev/releases/1.3.1/"},"next":{"docname":"releases/1.2.7","title":"Django 1.2.7 release notes","url":"/en/dev/releases/1.2.7/"},"formats":{"html":"/en/dev/releases/1.3/","markdown":"/en/dev/releases/1.3.md","json":"/en/dev/releases/1.3.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.3.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.3/","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"]}