{"title":"Porting your apps from Django 0.96 to 1.0","version":"6.0","locale":"es","docname":"releases/1.0-porting-guide","url":"/es/6.0/releases/1.0-porting-guide/","canonical":"https://djangodocs.dev/es/6.0/releases/1.0-porting-guide/","summary":"Django 1.0 breaks compatibility with 0.96 in some areas. This guide will help you port 0.96 projects and apps to 1.0. The first part of this document includes the…","html":"<h1>Porting your apps from Django 0.96 to 1.0<a class=\"heading-anchor\" href=\"#porting-your-apps-from-django-0-96-to-1-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Django 1.0 breaks compatibility with 0.96 in some areas.</p>\n<p>This guide will help you port 0.96 projects and apps to 1.0. The first part of\nthis document includes the common changes needed to run with 1.0. If after\ngoing through the first part your code still breaks, check the section\n<a class=\"reference internal\" href=\"#less-common-changes\">Less-common Changes</a> for a list of a bunch of less-common compatibility\nissues.</p>\n<aside class=\"admonition admonition-seealso\" role=\"note\">\n<p class=\"admonition-title\">Ver también</p>\n<p>The <a class=\"reference internal\" href=\"/es/6.0/releases/1.0/\"><span class=\"doc\">1.0 release notes</span></a>. That document explains the\nnew features in 1.0 more deeply; the porting guide is more concerned with\nhelping you quickly update your code.</p>\n</aside>\n<section id=\"common-changes\">\n<h2>Common changes<a class=\"heading-anchor\" href=\"#common-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>This section describes the changes between 0.96 and 1.0 that most users will\nneed to make.</p>\n<section id=\"use-unicode\">\n<h3>Use Unicode<a class=\"heading-anchor\" href=\"#use-unicode\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Change string literals (<code class=\"docutils literal notranslate\">'foo'</code>) into Unicode literals (<code class=\"docutils literal notranslate\">u'foo'</code>). Django\nnow uses Unicode strings throughout. In most places, raw strings will continue\nto work, but updating to use Unicode literals will prevent some obscure\nproblems.</p>\n<p>See <a class=\"reference internal\" href=\"/es/6.0/ref/unicode/\"><span class=\"doc\">Unicode data</span></a> for full details.</p>\n</section>\n<section id=\"models\">\n<h3>Models<a class=\"heading-anchor\" href=\"#models\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Common changes to your models file:</p>\n<section id=\"rename-maxlength-to-max-length\">\n<h4>Rename <code class=\"docutils literal notranslate\">maxlength</code> to <code class=\"docutils literal notranslate\">max_length</code><a class=\"heading-anchor\" href=\"#rename-maxlength-to-max-length\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Rename your <code class=\"docutils literal notranslate\">maxlength</code> argument to <code class=\"docutils literal notranslate\">max_length</code> (this was changed to be\nconsistent with form fields):</p>\n</section>\n<section id=\"replace-str-with-unicode\">\n<h4>Replace <code class=\"docutils literal notranslate\">__str__</code> with <code class=\"docutils literal notranslate\">__unicode__</code><a class=\"heading-anchor\" href=\"#replace-str-with-unicode\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Replace your model’s <code class=\"docutils literal notranslate\">__str__</code> function with a <code class=\"docutils literal notranslate\">__unicode__</code> method, and\nmake sure you <a class=\"reference internal\" href=\"#use-unicode\">use Unicode</a> (<code class=\"docutils literal notranslate\">u'foo'</code>) in that method.</p>\n</section>\n<section id=\"remove-prepopulated-from\">\n<h4>Remove <code class=\"docutils literal notranslate\">prepopulated_from</code><a class=\"heading-anchor\" href=\"#remove-prepopulated-from\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Remove the <code class=\"docutils literal notranslate\">prepopulated_from</code> argument on model fields. It’s no longer valid\nand has been moved to the <code class=\"docutils literal notranslate\">ModelAdmin</code> class in <code class=\"docutils literal notranslate\">admin.py</code>. See <a class=\"reference internal\" href=\"#the-admin\">the\nadmin</a>, below, for more details about changes to the admin.</p>\n</section>\n<section id=\"remove-core\">\n<h4>Remove <code class=\"docutils literal notranslate\">core</code><a class=\"heading-anchor\" href=\"#remove-core\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Remove the <code class=\"docutils literal notranslate\">core</code> argument from your model fields. It is no longer\nnecessary, since the equivalent functionality (part of <a class=\"reference internal\" href=\"/es/6.0/ref/contrib/admin/#admin-inlines\"><span class=\"std std-ref\">inline editing</span></a>) is handled differently by the admin interface now. You don’t\nhave to worry about inline editing until you get to <a class=\"reference internal\" href=\"#the-admin\">the admin</a> section,\nbelow. For now, remove all references to <code class=\"docutils literal notranslate\">core</code>.</p>\n</section>\n<section id=\"replace-class-admin-with-admin-py\">\n<h4>Replace <code class=\"docutils literal notranslate\">class Admin:</code> with <code class=\"docutils literal notranslate\">admin.py</code><a class=\"heading-anchor\" href=\"#replace-class-admin-with-admin-py\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Remove all your inner <code class=\"docutils literal notranslate\">class Admin</code> declarations from your models. They won’t\nbreak anything if you leave them, but they also won’t do anything. To register\napps with the admin you’ll move those declarations to an <code class=\"docutils literal notranslate\">admin.py</code> file;\nsee <a class=\"reference internal\" href=\"#the-admin\">the admin</a> below for more details.</p>\n<aside class=\"admonition admonition-seealso\" role=\"note\">\n<p class=\"admonition-title\">Ver también</p>\n<p>A contributor to <a class=\"reference external\" href=\"https://djangosnippets.org/\">djangosnippets</a> has written a script that’ll <a class=\"reference external\" href=\"https://djangosnippets.org/snippets/603/\">scan your\nmodels.py and generate a corresponding admin.py</a>.</p>\n</aside>\n</section>\n<section id=\"example\">\n<h4>Example<a class=\"heading-anchor\" href=\"#example\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Below is an example <code class=\"docutils literal notranslate\">models.py</code> file with all the changes you’ll need to\nmake:</p>\n<p>Old (0.96) <code class=\"docutils literal notranslate\">models.py</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=\"k\">class</span> <span class=\"nc\">Author</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    first_name <span class=\"o\">=</span> models<span class=\"o\">.</span>CharField<span class=\"p\">(</span>maxlength<span class=\"o\">=</span><span class=\"mi\">30</span><span class=\"p\">)</span>\n    last_name <span class=\"o\">=</span> models<span class=\"o\">.</span>CharField<span class=\"p\">(</span>maxlength<span class=\"o\">=</span><span class=\"mi\">30</span><span class=\"p\">)</span>\n    slug <span class=\"o\">=</span> models<span class=\"o\">.</span>CharField<span class=\"p\">(</span>maxlength<span class=\"o\">=</span><span class=\"mi\">60</span><span class=\"p\">,</span> prepopulate_from<span class=\"o\">=</span><span class=\"p\">(</span><span class=\"s2\">&quot;first_name&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;last_name&quot;</span><span class=\"p\">))</span>\n\n    <span class=\"k\">class</span> <span class=\"nc\">Admin</span><span class=\"p\">:</span>\n        list_display <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"s2\">&quot;first_name&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;last_name&quot;</span><span class=\"p\">]</span>\n\n    <span class=\"k\">def</span> <span class=\"fm\">__str__</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"k\">return</span> <span class=\"s2\">&quot;</span><span class=\"si\">%s</span><span class=\"s2\"> </span><span class=\"si\">%s</span><span class=\"s2\">&quot;</span> <span class=\"o\">%</span> <span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"o\">.</span>first_name<span class=\"p\">,</span> <span class=\"bp\">self</span><span class=\"o\">.</span>last_name<span class=\"p\">)</span>\n</code></pre></div>\n<p>New (1.0) <code class=\"docutils literal notranslate\">models.py</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=\"k\">class</span> <span class=\"nc\">Author</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    first_name <span class=\"o\">=</span> models<span class=\"o\">.</span>CharField<span class=\"p\">(</span>max_length<span class=\"o\">=</span><span class=\"mi\">30</span><span class=\"p\">)</span>\n    last_name <span class=\"o\">=</span> models<span class=\"o\">.</span>CharField<span class=\"p\">(</span>max_length<span class=\"o\">=</span><span class=\"mi\">30</span><span class=\"p\">)</span>\n    slug <span class=\"o\">=</span> models<span class=\"o\">.</span>CharField<span class=\"p\">(</span>max_length<span class=\"o\">=</span><span class=\"mi\">60</span><span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">__unicode__</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"k\">return</span> <span class=\"s2\">&quot;</span><span class=\"si\">%s</span><span class=\"s2\"> </span><span class=\"si\">%s</span><span class=\"s2\">&quot;</span> <span class=\"o\">%</span> <span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"o\">.</span>first_name<span class=\"p\">,</span> <span class=\"bp\">self</span><span class=\"o\">.</span>last_name<span class=\"p\">)</span>\n</code></pre></div>\n<p>New (1.0) <code class=\"docutils literal notranslate\">admin.py</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.contrib</span> <span class=\"kn\">import</span> admin\n<span class=\"kn\">from</span> <span class=\"nn\">models</span> <span class=\"kn\">import</span> Author\n\n\n<span class=\"k\">class</span> <span class=\"nc\">AuthorAdmin</span><span class=\"p\">(</span>admin<span class=\"o\">.</span>ModelAdmin<span class=\"p\">):</span>\n    list_display <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"s2\">&quot;first_name&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;last_name&quot;</span><span class=\"p\">]</span>\n    prepopulated_fields <span class=\"o\">=</span> <span class=\"p\">{</span><span class=\"s2\">&quot;slug&quot;</span><span class=\"p\">:</span> <span class=\"p\">(</span><span class=\"s2\">&quot;first_name&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;last_name&quot;</span><span class=\"p\">)}</span>\n\n\nadmin<span class=\"o\">.</span>site<span class=\"o\">.</span>register<span class=\"p\">(</span>Author<span class=\"p\">,</span> AuthorAdmin<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n</section>\n<section id=\"the-admin\">\n<h3>The Admin<a class=\"heading-anchor\" href=\"#the-admin\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>One of the biggest changes in 1.0 is the new admin. The Django administrative\ninterface (<code class=\"docutils literal notranslate\">django.contrib.admin</code>) has been completely refactored; admin\ndefinitions are now completely decoupled from model definitions, the framework\nhas been rewritten to use Django’s new form-handling library and redesigned\nwith extensibility and customization in mind.</p>\n<p>Practically, this means you’ll need to rewrite all of your <code class=\"docutils literal notranslate\">class Admin</code>\ndeclarations. You’ve already seen in <a class=\"reference internal\" href=\"#models\">models</a> above how to replace your\n<code class=\"docutils literal notranslate\">class Admin</code> with an <code class=\"docutils literal notranslate\">admin.site.register()</code> call in an <code class=\"docutils literal notranslate\">admin.py</code> file.\nBelow are some more details on how to rewrite that <code class=\"docutils literal notranslate\">Admin</code> declaration into\nthe new syntax.</p>\n<section id=\"use-new-inline-syntax\">\n<h4>Use new inline syntax<a class=\"heading-anchor\" href=\"#use-new-inline-syntax\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The new <code class=\"docutils literal notranslate\">edit_inline</code> options have all been moved to <code class=\"docutils literal notranslate\">admin.py</code>. Here’s an\nexample:</p>\n<p>Old (0.96):</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\">Parent</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span> <span class=\"o\">...</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">Child</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    parent <span class=\"o\">=</span> models<span class=\"o\">.</span>ForeignKey<span class=\"p\">(</span>Parent<span class=\"p\">,</span> edit_inline<span class=\"o\">=</span>models<span class=\"o\">.</span>STACKED<span class=\"p\">,</span> num_in_admin<span class=\"o\">=</span><span class=\"mi\">3</span><span class=\"p\">)</span>\n</code></pre></div>\n<p>New (1.0):</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\">ChildInline</span><span class=\"p\">(</span>admin<span class=\"o\">.</span>StackedInline<span class=\"p\">):</span>\n    model <span class=\"o\">=</span> Child\n    extra <span class=\"o\">=</span> <span class=\"mi\">3</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">ParentAdmin</span><span class=\"p\">(</span>admin<span class=\"o\">.</span>ModelAdmin<span class=\"p\">):</span>\n    model <span class=\"o\">=</span> Parent\n    inlines <span class=\"o\">=</span> <span class=\"p\">[</span>ChildInline<span class=\"p\">]</span>\n\n\nadmin<span class=\"o\">.</span>site<span class=\"o\">.</span>register<span class=\"p\">(</span>Parent<span class=\"p\">,</span> ParentAdmin<span class=\"p\">)</span>\n</code></pre></div>\n<p>See <a class=\"reference internal\" href=\"/es/6.0/ref/contrib/admin/#admin-inlines\"><span class=\"std std-ref\">InlineModelAdmin objects</span></a> for more details.</p>\n</section>\n<section id=\"simplify-fields-or-use-fieldsets\">\n<h4>Simplify <code class=\"docutils literal notranslate\">fields</code>, or use <code class=\"docutils literal notranslate\">fieldsets</code><a class=\"heading-anchor\" href=\"#simplify-fields-or-use-fieldsets\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The old <code class=\"docutils literal notranslate\">fields</code> syntax was quite confusing, and has been simplified. The old\nsyntax still works, but you’ll need to use <code class=\"docutils literal notranslate\">fieldsets</code> instead.</p>\n<p>Old (0.96):</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\">ModelOne</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    <span class=\"o\">...</span>\n\n    <span class=\"k\">class</span> <span class=\"nc\">Admin</span><span class=\"p\">:</span>\n        fields <span class=\"o\">=</span> <span class=\"p\">((</span><span class=\"kc\">None</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"s2\">&quot;fields&quot;</span><span class=\"p\">:</span> <span class=\"p\">(</span><span class=\"s2\">&quot;foo&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;bar&quot;</span><span class=\"p\">)}),)</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">ModelTwo</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    <span class=\"o\">...</span>\n\n    <span class=\"k\">class</span> <span class=\"nc\">Admin</span><span class=\"p\">:</span>\n        fields <span class=\"o\">=</span> <span class=\"p\">(</span>\n            <span class=\"p\">(</span><span class=\"s2\">&quot;group1&quot;</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"s2\">&quot;fields&quot;</span><span class=\"p\">:</span> <span class=\"p\">(</span><span class=\"s2\">&quot;foo&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;bar&quot;</span><span class=\"p\">),</span> <span class=\"s2\">&quot;classes&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;collapse&quot;</span><span class=\"p\">}),</span>\n            <span class=\"p\">(</span><span class=\"s2\">&quot;group2&quot;</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"s2\">&quot;fields&quot;</span><span class=\"p\">:</span> <span class=\"p\">(</span><span class=\"s2\">&quot;spam&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;eggs&quot;</span><span class=\"p\">),</span> <span class=\"s2\">&quot;classes&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;collapse wide&quot;</span><span class=\"p\">}),</span>\n        <span class=\"p\">)</span>\n</code></pre></div>\n<p>New (1.0):</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\">ModelOneAdmin</span><span class=\"p\">(</span>admin<span class=\"o\">.</span>ModelAdmin<span class=\"p\">):</span>\n    fields <span class=\"o\">=</span> <span class=\"p\">(</span><span class=\"s2\">&quot;foo&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;bar&quot;</span><span class=\"p\">)</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">ModelTwoAdmin</span><span class=\"p\">(</span>admin<span class=\"o\">.</span>ModelAdmin<span class=\"p\">):</span>\n    fieldsets <span class=\"o\">=</span> <span class=\"p\">(</span>\n        <span class=\"p\">(</span><span class=\"s2\">&quot;group1&quot;</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"s2\">&quot;fields&quot;</span><span class=\"p\">:</span> <span class=\"p\">(</span><span class=\"s2\">&quot;foo&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;bar&quot;</span><span class=\"p\">),</span> <span class=\"s2\">&quot;classes&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;collapse&quot;</span><span class=\"p\">}),</span>\n        <span class=\"p\">(</span><span class=\"s2\">&quot;group2&quot;</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"s2\">&quot;fields&quot;</span><span class=\"p\">:</span> <span class=\"p\">(</span><span class=\"s2\">&quot;spam&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;eggs&quot;</span><span class=\"p\">),</span> <span class=\"s2\">&quot;classes&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;collapse wide&quot;</span><span class=\"p\">}),</span>\n    <span class=\"p\">)</span>\n</code></pre></div>\n<aside class=\"admonition admonition-seealso\" role=\"note\">\n<p class=\"admonition-title\">Ver también</p>\n<ul class=\"simple\">\n<li><p>More detailed information about the changes and the reasons behind them\ncan be found on the <a class=\"reference external\" href=\"https://code.djangoproject.com/wiki/NewformsAdminBranch\">NewformsAdminBranch wiki page</a></p></li>\n<li><p>The new admin comes with a ton of new features; you can read about them\nin the <a class=\"reference internal\" href=\"/es/6.0/ref/contrib/admin/\"><span class=\"doc\">admin documentation</span></a>.</p></li>\n</ul>\n</aside>\n</section>\n</section>\n<section id=\"urls\">\n<h3>URLs<a class=\"heading-anchor\" href=\"#urls\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"update-your-root-urls-py\">\n<h4>Update your root <code class=\"docutils literal notranslate\">urls.py</code><a class=\"heading-anchor\" href=\"#update-your-root-urls-py\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>If you’re using the admin site, you need to update your root <code class=\"docutils literal notranslate\">urls.py</code>.</p>\n<p>Old (0.96) <code class=\"docutils literal notranslate\">urls.py</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.conf.urls.defaults</span> <span class=\"kn\">import</span> <span class=\"o\">*</span>\n\nurlpatterns <span class=\"o\">=</span> patterns<span class=\"p\">(</span>\n    <span class=\"s2\">&quot;&quot;</span><span class=\"p\">,</span>\n    <span class=\"p\">(</span><span class=\"sa\">r</span><span class=\"s2\">&quot;^admin/&quot;</span><span class=\"p\">,</span> include<span class=\"p\">(</span><span class=\"s2\">&quot;django.contrib.admin.urls&quot;</span><span class=\"p\">)),</span>\n    <span class=\"c1\"># ... the rest of your URLs here ...</span>\n<span class=\"p\">)</span>\n</code></pre></div>\n<p>New (1.0) <code class=\"docutils literal notranslate\">urls.py</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.conf.urls.defaults</span> <span class=\"kn\">import</span> <span class=\"o\">*</span>\n\n<span class=\"c1\"># The next two lines enable the admin and load each admin.py file:</span>\n<span class=\"kn\">from</span> <span class=\"nn\">django.contrib</span> <span class=\"kn\">import</span> admin\n\nadmin<span class=\"o\">.</span>autodiscover<span class=\"p\">()</span>\n\nurlpatterns <span class=\"o\">=</span> patterns<span class=\"p\">(</span>\n    <span class=\"s2\">&quot;&quot;</span><span class=\"p\">,</span>\n    <span class=\"p\">(</span><span class=\"sa\">r</span><span class=\"s2\">&quot;^admin/(.*)&quot;</span><span class=\"p\">,</span> admin<span class=\"o\">.</span>site<span class=\"o\">.</span>root<span class=\"p\">),</span>\n    <span class=\"c1\"># ... the rest of your URLs here ...</span>\n<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n</section>\n<section id=\"views\">\n<h3>Views<a class=\"heading-anchor\" href=\"#views\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"use-django-forms-instead-of-newforms\">\n<h4>Use <code class=\"docutils literal notranslate\">django.forms</code> instead of <code class=\"docutils literal notranslate\">newforms</code><a class=\"heading-anchor\" href=\"#use-django-forms-instead-of-newforms\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Replace <code class=\"docutils literal notranslate\">django.newforms</code> with <code class=\"docutils literal notranslate\">django.forms</code> – Django 1.0 renamed the\n<code class=\"docutils literal notranslate\">newforms</code> module (introduced in 0.96) to plain old <code class=\"docutils literal notranslate\">forms</code>. The\n<code class=\"docutils literal notranslate\">oldforms</code> module was also removed.</p>\n<p>If you’re already using the <code class=\"docutils literal notranslate\">newforms</code> library, and you used our recommended\n<code class=\"docutils literal notranslate\">import</code> statement syntax, all you have to do is change your import\nstatements.</p>\n<p>Old:</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> newforms <span class=\"k\">as</span> forms\n</code></pre></div>\n<p>New:</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</code></pre></div>\n<p>If you’re using the old forms system (formerly known as <code class=\"docutils literal notranslate\">django.forms</code> and\n<code class=\"docutils literal notranslate\">django.oldforms</code>), you’ll have to rewrite your forms. A good place to start\nis the <a class=\"reference internal\" href=\"/es/6.0/topics/forms/\"><span class=\"doc\">forms documentation</span></a></p>\n</section>\n<section id=\"handle-uploaded-files-using-the-new-api\">\n<h4>Handle uploaded files using the new API<a class=\"heading-anchor\" href=\"#handle-uploaded-files-using-the-new-api\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Replace use of uploaded files – that is, entries in <code class=\"docutils literal notranslate\">request.FILES</code> – as\nsimple dictionaries with the new\n<a class=\"reference internal\" href=\"/es/6.0/ref/files/uploads/#django.core.files.uploadedfile.UploadedFile\" title=\"django.core.files.uploadedfile.UploadedFile\"><code class=\"xref py py-class docutils literal notranslate\">UploadedFile</code></a>. The old dictionary\nsyntax no longer works.</p>\n<p>Thus, in a view like:</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\">def</span> <span class=\"nf\">my_view</span><span class=\"p\">(</span>request<span class=\"p\">):</span>\n    f <span class=\"o\">=</span> request<span class=\"o\">.</span>FILES<span class=\"p\">[</span><span class=\"s2\">&quot;file_field_name&quot;</span><span class=\"p\">]</span>\n    <span class=\"o\">...</span>\n</code></pre></div>\n<p>…you’d need to make the following changes:</p>\n<div class=\"table-scroll\" role=\"region\" tabindex=\"0\" aria-label=\"Table\"><table class=\"docutils align-default\">\n<thead>\n<tr class=\"row-odd\"><th class=\"head\"><p>Old (0.96)</p></th>\n<th class=\"head\"><p>New (1.0)</p></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">f['content']</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">f.read()</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">f['filename']</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">f.name</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">f['content-type']</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">f.content_type</code></p></td>\n</tr>\n</tbody>\n</table>\n</div>\n</section>\n<section id=\"work-with-file-fields-using-the-new-api\">\n<h4>Work with file fields using the new API<a class=\"heading-anchor\" href=\"#work-with-file-fields-using-the-new-api\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The internal implementation of <a class=\"reference internal\" href=\"/es/6.0/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\">django.db.models.FileField</code></a> have\nchanged. A visible result of this is that the way you access special attributes\n(URL, filename, image size, etc.) of these model fields has changed. You will\nneed to make the following changes, assuming your model’s\n<a class=\"reference internal\" href=\"/es/6.0/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\">FileField</code></a> is called <code class=\"docutils literal notranslate\">myfile</code>:</p>\n<div class=\"table-scroll\" role=\"region\" tabindex=\"0\" aria-label=\"Table\"><table class=\"docutils align-default\">\n<thead>\n<tr class=\"row-odd\"><th class=\"head\"><p>Old (0.96)</p></th>\n<th class=\"head\"><p>New (1.0)</p></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">myfile.get_content_filename()</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">myfile.content.path</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">myfile.get_content_url()</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">myfile.content.url</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">myfile.get_content_size()</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">myfile.content.size</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">myfile.save_content_file()</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">myfile.content.save()</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">myfile.get_content_width()</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">myfile.content.width</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">myfile.get_content_height()</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">myfile.content.height</code></p></td>\n</tr>\n</tbody>\n</table>\n</div>\n<p>Note that the <code class=\"docutils literal notranslate\">width</code> and <code class=\"docutils literal notranslate\">height</code> attributes only make sense for\n<a class=\"reference internal\" href=\"/es/6.0/ref/models/fields/#django.db.models.ImageField\" title=\"django.db.models.ImageField\"><code class=\"xref py py-class docutils literal notranslate\">ImageField</code></a> fields. More details can be found in the\n<a class=\"reference internal\" href=\"/es/6.0/ref/models/fields/\"><span class=\"doc\">model API</span></a> documentation.</p>\n</section>\n<section id=\"use-paginator-instead-of-objectpaginator\">\n<h4>Use <code class=\"docutils literal notranslate\">Paginator</code> instead of <code class=\"docutils literal notranslate\">ObjectPaginator</code><a class=\"heading-anchor\" href=\"#use-paginator-instead-of-objectpaginator\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The <code class=\"docutils literal notranslate\">ObjectPaginator</code> in 0.96 has been removed and replaced with an improved\nversion, <a class=\"reference internal\" href=\"/es/6.0/ref/paginator/#django.core.paginator.Paginator\" title=\"django.core.paginator.Paginator\"><code class=\"xref py py-class docutils literal notranslate\">django.core.paginator.Paginator</code></a>.</p>\n</section>\n</section>\n<section id=\"templates\">\n<h3>Templates<a class=\"heading-anchor\" href=\"#templates\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"learn-to-love-autoescaping\">\n<h4>Learn to love autoescaping<a class=\"heading-anchor\" href=\"#learn-to-love-autoescaping\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>By default, the template system now automatically HTML-escapes the output of\nevery variable. To learn more, see <a class=\"reference internal\" href=\"/es/6.0/ref/templates/language/#automatic-html-escaping\"><span class=\"std std-ref\">Automatic HTML escaping</span></a>.</p>\n<p>To disable auto-escaping for an individual variable, use the <a class=\"reference internal\" href=\"/es/6.0/ref/templates/builtins/#std-templatefilter-safe\"><code class=\"xref std std-tfilter docutils literal notranslate\">safe</code></a>\nfilter:</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>This will be escaped: <span class=\"cp\">{{</span> <span class=\"nv\">data</span> <span class=\"cp\">}}</span>\nThis will not be escaped: <span class=\"cp\">{{</span> <span class=\"nv\">data</span><span class=\"o\">|</span><span class=\"nf\">safe</span> <span class=\"cp\">}}</span>\n</code></pre></div>\n<p>To disable auto-escaping for an entire template, wrap the template (or just a\nparticular section of the template) in the <a class=\"reference internal\" href=\"/es/6.0/ref/templates/builtins/#std-templatetag-autoescape\"><code class=\"xref std std-ttag docutils literal notranslate\">autoescape</code></a> tag:</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\">autoescape</span> <span class=\"nv\">off</span> <span class=\"cp\">%}</span>\n   ... unescaped template content here ...\n<span class=\"cp\">{%</span> <span class=\"k\">endautoescape</span> <span class=\"cp\">%}</span>\n</code></pre></div>\n</section>\n</section>\n</section>\n<section id=\"less-common-changes\">\n<h2>Less-common changes<a class=\"heading-anchor\" href=\"#less-common-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>The following changes are smaller, more localized changes. They should only\naffect more advanced users, but it’s probably worth reading through the list\nand checking your code for these things.</p>\n<section id=\"signals\">\n<h3>Signals<a class=\"heading-anchor\" href=\"#signals\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>Add <code class=\"docutils literal notranslate\">**kwargs</code> to any registered signal handlers.</p></li>\n<li><p>Connect, disconnect, and send signals via methods on the\n<a class=\"reference internal\" href=\"/es/6.0/topics/signals/#django.dispatch.Signal\" title=\"django.dispatch.Signal\"><code class=\"xref py py-class docutils literal notranslate\">Signal</code></a> object instead of through module methods in\n<code class=\"docutils literal notranslate\">django.dispatch.dispatcher</code>.</p></li>\n<li><p>Remove any use of the <code class=\"docutils literal notranslate\">Anonymous</code> and <code class=\"docutils literal notranslate\">Any</code> sender options; they no\nlonger exist. You can still receive signals sent by any sender by using\n<code class=\"docutils literal notranslate\">sender=None</code></p></li>\n<li><p>Make any custom signals you’ve declared into instances of\n<a class=\"reference internal\" href=\"/es/6.0/topics/signals/#django.dispatch.Signal\" title=\"django.dispatch.Signal\"><code class=\"xref py py-class docutils literal notranslate\">django.dispatch.Signal</code></a> instead of anonymous objects.</p></li>\n</ul>\n<p>Here’s quick summary of the code changes you’ll need to make:</p>\n<div class=\"table-scroll\" role=\"region\" tabindex=\"0\" aria-label=\"Table\"><table class=\"docutils align-default\">\n<thead>\n<tr class=\"row-odd\"><th class=\"head\"><p>Old (0.96)</p></th>\n<th class=\"head\"><p>New (1.0)</p></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">def callback(sender)</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">def callback(sender, **kwargs)</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">sig = object()</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">sig = django.dispatch.Signal()</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">dispatcher.connect(callback, sig)</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">sig.connect(callback)</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">dispatcher.send(sig, sender)</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">sig.send(sender)</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">dispatcher.connect(callback, sig, sender=Any)</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">sig.connect(callback, sender=None)</code></p></td>\n</tr>\n</tbody>\n</table>\n</div>\n</section>\n<section id=\"comments\">\n<h3>Comments<a class=\"heading-anchor\" href=\"#comments\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you were using Django 0.96’s <code class=\"docutils literal notranslate\">django.contrib.comments</code> app, you’ll need to\nupgrade to the new comments app introduced in 1.0. See the upgrade guide\nfor details.</p>\n</section>\n<section id=\"template-tags\">\n<h3>Template tags<a class=\"heading-anchor\" href=\"#template-tags\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"spaceless-tag\">\n<h4><a class=\"reference internal\" href=\"/es/6.0/ref/templates/builtins/#std-templatetag-spaceless\"><code class=\"xref std std-ttag docutils literal notranslate\">spaceless</code></a> tag<a class=\"heading-anchor\" href=\"#spaceless-tag\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The <code class=\"docutils literal notranslate\">spaceless</code> template tag now removes <em>all</em> spaces between HTML tags,\ninstead of preserving a single space.</p>\n</section>\n</section>\n<section id=\"local-flavors\">\n<h3>Local flavors<a class=\"heading-anchor\" href=\"#local-flavors\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"u-s-local-flavor\">\n<h4>U.S. local flavor<a class=\"heading-anchor\" href=\"#u-s-local-flavor\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><code class=\"docutils literal notranslate\">django.contrib.localflavor.usa</code> has been renamed to\n<code class=\"docutils literal notranslate\">django.contrib.localflavor.us</code>. This change was made to match the naming\nscheme of other local flavors. To migrate your code, all you need to do is\nchange the imports.</p>\n</section>\n</section>\n<section id=\"sessions\">\n<h3>Sessions<a class=\"heading-anchor\" href=\"#sessions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"getting-a-new-session-key\">\n<h4>Getting a new session key<a class=\"heading-anchor\" href=\"#getting-a-new-session-key\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><code class=\"docutils literal notranslate\">SessionBase.get_new_session_key()</code> has been renamed to\n<code class=\"docutils literal notranslate\">_get_new_session_key()</code>. <code class=\"docutils literal notranslate\">get_new_session_object()</code> no longer exists.</p>\n</section>\n</section>\n<section id=\"fixtures\">\n<h3>Fixtures<a class=\"heading-anchor\" href=\"#fixtures\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"loading-a-row-no-longer-calls-save\">\n<h4>Loading a row no longer calls <code class=\"docutils literal notranslate\">save()</code><a class=\"heading-anchor\" href=\"#loading-a-row-no-longer-calls-save\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Previously, loading a row automatically ran the model’s <code class=\"docutils literal notranslate\">save()</code> method. This\nis no longer the case, so any fields (for example: timestamps) that were\nauto-populated by a <code class=\"docutils literal notranslate\">save()</code> now need explicit values in any fixture.</p>\n</section>\n</section>\n<section id=\"settings\">\n<h3>Settings<a class=\"heading-anchor\" href=\"#settings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"better-exceptions\">\n<h4>Better exceptions<a class=\"heading-anchor\" href=\"#better-exceptions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The old <a class=\"reference external\" href=\"https://docs.python.org/3/library/exceptions.html#EnvironmentError\" title=\"(en Python versión 3.14)\"><code class=\"xref py py-exc docutils literal notranslate\">EnvironmentError</code></a> has split into an\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/exceptions.html#ImportError\" title=\"(en Python versión 3.14)\"><code class=\"xref py py-exc docutils literal notranslate\">ImportError</code></a> when Django fails to find the settings module\nand a <a class=\"reference external\" href=\"https://docs.python.org/3/library/exceptions.html#RuntimeError\" title=\"(en Python versión 3.14)\"><code class=\"xref py py-exc docutils literal notranslate\">RuntimeError</code></a> when you try to reconfigure settings\nafter having already used them.</p>\n</section>\n<section id=\"login-url-has-moved\">\n<h4><a class=\"reference internal\" href=\"/es/6.0/ref/settings/#std-setting-LOGIN_URL\"><code class=\"xref std std-setting docutils literal notranslate\">LOGIN_URL</code></a> has moved<a class=\"heading-anchor\" href=\"#login-url-has-moved\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The <a class=\"reference internal\" href=\"/es/6.0/ref/settings/#std-setting-LOGIN_URL\"><code class=\"xref std std-setting docutils literal notranslate\">LOGIN_URL</code></a> constant moved from <code class=\"docutils literal notranslate\">django.contrib.auth</code> into the\n<code class=\"docutils literal notranslate\">settings</code> module. Instead of using <code class=\"docutils literal notranslate\">from django.contrib.auth import\nLOGIN_URL</code> refer to <a class=\"reference internal\" href=\"/es/6.0/ref/settings/#std-setting-LOGIN_URL\"><code class=\"xref std std-setting docutils literal notranslate\">settings.LOGIN_URL</code></a>.</p>\n</section>\n<section id=\"append-slash-behavior-has-been-updated\">\n<h4><a class=\"reference internal\" href=\"/es/6.0/ref/settings/#std-setting-APPEND_SLASH\"><code class=\"xref std std-setting docutils literal notranslate\">APPEND_SLASH</code></a> behavior has been updated<a class=\"heading-anchor\" href=\"#append-slash-behavior-has-been-updated\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>In 0.96, if a URL didn’t end in a slash or have a period in the final\ncomponent of its path, and <a class=\"reference internal\" href=\"/es/6.0/ref/settings/#std-setting-APPEND_SLASH\"><code class=\"xref std std-setting docutils literal notranslate\">APPEND_SLASH</code></a> was True, Django would\nredirect to the same URL, but with a slash appended to the end. Now, Django\nchecks to see whether the pattern without the trailing slash would be matched\nby something in your URL patterns. If so, no redirection takes place, because\nit is assumed you deliberately wanted to catch that pattern.</p>\n<p>For most people, this won’t require any changes. Some people, though, have URL\npatterns that look like this:</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=\"sa\">r</span><span class=\"s2\">&quot;/some_prefix/(.*)$&quot;</span>\n</code></pre></div>\n<p>Previously, those patterns would have been redirected to have a trailing\nslash. If you always want a slash on such URLs, rewrite the pattern as:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"sa\">r</span><span class=\"s2\">&quot;/some_prefix/(.*/)$&quot;</span>\n</code></pre></div>\n</section>\n</section>\n<section id=\"smaller-model-changes\">\n<h3>Smaller model changes<a class=\"heading-anchor\" href=\"#smaller-model-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"different-exception-from-get\">\n<h4>Different exception from <code class=\"docutils literal notranslate\">get()</code><a class=\"heading-anchor\" href=\"#different-exception-from-get\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Managers now return a <a class=\"reference internal\" href=\"/es/6.0/ref/exceptions/#django.core.exceptions.MultipleObjectsReturned\" title=\"django.core.exceptions.MultipleObjectsReturned\"><code class=\"xref py py-exc docutils literal notranslate\">MultipleObjectsReturned</code></a>\nexception instead of <a class=\"reference external\" href=\"https://docs.python.org/3/library/exceptions.html#AssertionError\" title=\"(en Python versión 3.14)\"><code class=\"xref py py-exc docutils literal notranslate\">AssertionError</code></a>:</p>\n<p>Old (0.96):</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\">try</span><span class=\"p\">:</span>\n    Model<span class=\"o\">.</span>objects<span class=\"o\">.</span>get<span class=\"p\">(</span><span class=\"o\">...</span><span class=\"p\">)</span>\n<span class=\"k\">except</span> <span class=\"ne\">AssertionError</span><span class=\"p\">:</span>\n    handle_the_error<span class=\"p\">()</span>\n</code></pre></div>\n<p>New (1.0):</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\">try</span><span class=\"p\">:</span>\n    Model<span class=\"o\">.</span>objects<span class=\"o\">.</span>get<span class=\"p\">(</span><span class=\"o\">...</span><span class=\"p\">)</span>\n<span class=\"k\">except</span> Model<span class=\"o\">.</span>MultipleObjectsReturned<span class=\"p\">:</span>\n    handle_the_error<span class=\"p\">()</span>\n</code></pre></div>\n</section>\n<section id=\"lazydate-has-been-fired\">\n<h4><code class=\"docutils literal notranslate\">LazyDate</code> has been fired<a class=\"heading-anchor\" href=\"#lazydate-has-been-fired\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The <code class=\"docutils literal notranslate\">LazyDate</code> helper class no longer exists.</p>\n<p>Default field values and query arguments can both be callable objects, so\ninstances of <code class=\"docutils literal notranslate\">LazyDate</code> can be replaced with a reference to\n<code class=\"docutils literal notranslate\">datetime.datetime.now</code>:</p>\n<p>Old (0.96):</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\">Article</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    title <span class=\"o\">=</span> models<span class=\"o\">.</span>CharField<span class=\"p\">(</span>maxlength<span class=\"o\">=</span><span class=\"mi\">100</span><span class=\"p\">)</span>\n    published <span class=\"o\">=</span> models<span class=\"o\">.</span>DateField<span class=\"p\">(</span>default<span class=\"o\">=</span>LazyDate<span class=\"p\">())</span>\n</code></pre></div>\n<p>New (1.0):</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\">datetime</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">Article</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    title <span class=\"o\">=</span> models<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    published <span class=\"o\">=</span> models<span class=\"o\">.</span>DateField<span class=\"p\">(</span>default<span class=\"o\">=</span>datetime<span class=\"o\">.</span>datetime<span class=\"o\">.</span>now<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"decimalfield-is-new-and-floatfield-is-now-a-proper-float\">\n<h4><code class=\"docutils literal notranslate\">DecimalField</code> is new, and <code class=\"docutils literal notranslate\">FloatField</code> is now a proper float<a class=\"heading-anchor\" href=\"#decimalfield-is-new-and-floatfield-is-now-a-proper-float\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Old (0.96):</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\">MyModel</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    field_name <span class=\"o\">=</span> models<span class=\"o\">.</span>FloatField<span class=\"p\">(</span>max_digits<span class=\"o\">=</span><span class=\"mi\">10</span><span class=\"p\">,</span> decimal_places<span class=\"o\">=</span><span class=\"mi\">3</span><span class=\"p\">)</span>\n    <span class=\"o\">...</span>\n</code></pre></div>\n<p>New (1.0):</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\">MyModel</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    field_name <span class=\"o\">=</span> models<span class=\"o\">.</span>DecimalField<span class=\"p\">(</span>max_digits<span class=\"o\">=</span><span class=\"mi\">10</span><span class=\"p\">,</span> decimal_places<span class=\"o\">=</span><span class=\"mi\">3</span><span class=\"p\">)</span>\n    <span class=\"o\">...</span>\n</code></pre></div>\n<p>If you forget to make this change, you will see errors about <code class=\"docutils literal notranslate\">FloatField</code>\nnot taking a <code class=\"docutils literal notranslate\">max_digits</code> attribute in <code class=\"docutils literal notranslate\">__init__</code>, because the new\n<code class=\"docutils literal notranslate\">FloatField</code> takes no precision-related arguments.</p>\n<p>If you’re using MySQL or PostgreSQL, no further changes are needed. The\ndatabase column types for <code class=\"docutils literal notranslate\">DecimalField</code> are the same as for the old\n<code class=\"docutils literal notranslate\">FloatField</code>.</p>\n<p>If you’re using SQLite, you need to force the database to view the\nappropriate columns as decimal types, rather than floats. To do this, you’ll\nneed to reload your data. Do this after you have made the change to using\n<code class=\"docutils literal notranslate\">DecimalField</code> in your code and updated the Django code.</p>\n<aside class=\"admonition admonition-warning\" role=\"note\">\n<p class=\"admonition-title\">Advertencia</p>\n<p><strong>Back up your database first!</strong></p>\n<p>For SQLite, this means making a copy of the single file that stores the\ndatabase (the name of that file is the <code class=\"docutils literal notranslate\">DATABASE_NAME</code> in your\n<code class=\"docutils literal notranslate\">settings.py</code> file).</p>\n</aside>\n<p>To upgrade each application to use a <code class=\"docutils literal notranslate\">DecimalField</code>, you can do the\nfollowing, replacing <code class=\"docutils literal notranslate\">&lt;app&gt;</code> in the code below with each app’s name:</p>\n<div class=\"code-block\" data-language=\"console\"><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><span class=\"gp\">$ </span>./manage.py dumpdata --format<span class=\"o\">=</span>xml &lt;app&gt; &gt; data-dump.xml\n<span class=\"gp\">$ </span>./manage.py reset &lt;app&gt;\n<span class=\"gp\">$ </span>./manage.py loaddata data-dump.xml\n</code></pre></div>\n<p>Notes:</p>\n<ol class=\"arabic simple\">\n<li><p>It’s important that you remember to use XML format in the first step of\nthis process. We are exploiting a feature of the XML data dumps that makes\nporting floats to decimals with SQLite possible.</p></li>\n<li><p>In the second step you will be asked to confirm that you are prepared to\nlose the data for the application(s) in question. Say yes; we’ll restore\nthis data in the third step.</p></li>\n<li><p><code class=\"docutils literal notranslate\">DecimalField</code> is not used in any of the apps shipped with Django prior\nto this change being made, so you do not need to worry about performing\nthis procedure for any of the standard Django models.</p></li>\n</ol>\n<p>If something goes wrong in the above process, just copy your backed up\ndatabase file over the original file and start again.</p>\n</section>\n</section>\n<section id=\"internationalization\">\n<h3>Internationalization<a class=\"heading-anchor\" href=\"#internationalization\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"django-views-i18n-set-language-now-requires-a-post-request\">\n<h4><a class=\"reference internal\" href=\"/es/6.0/topics/i18n/translation/#django.views.i18n.set_language\" title=\"django.views.i18n.set_language\"><code class=\"xref py py-func docutils literal notranslate\">django.views.i18n.set_language()</code></a> now requires a POST request<a class=\"heading-anchor\" href=\"#django-views-i18n-set-language-now-requires-a-post-request\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Previously, a GET request was used. The old behavior meant that state (the\nlocale used to display the site) could be changed by a GET request, which is\nagainst the HTTP specification’s recommendations. Code calling this view must\nensure that a POST request is now made, instead of a GET. This means you can\nno longer use a link to access the view, but must use a form submission of\nsome kind (e.g. a button).</p>\n</section>\n<section id=\"is-no-longer-in-builtins\">\n<h4><code class=\"docutils literal notranslate\">_()</code> is no longer in builtins<a class=\"heading-anchor\" href=\"#is-no-longer-in-builtins\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><code class=\"docutils literal notranslate\">_()</code> (the callable object whose name is a single underscore) is no longer\nmonkeypatched into builtins – that is, it’s no longer available magically in\nevery module.</p>\n<p>If you were previously relying on <code class=\"docutils literal notranslate\">_()</code> always being present, you should now\nexplicitly import <code class=\"docutils literal notranslate\">ugettext</code> or <code class=\"docutils literal notranslate\">ugettext_lazy</code>, if appropriate, and alias\nit to <code class=\"docutils literal notranslate\">_</code> yourself:</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.translation</span> <span class=\"kn\">import</span> ugettext <span class=\"k\">as</span> _\n</code></pre></div>\n</section>\n</section>\n<section id=\"http-request-response-objects\">\n<h3>HTTP request/response objects<a class=\"heading-anchor\" href=\"#http-request-response-objects\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"dictionary-access-to-httprequest\">\n<h4>Dictionary access to <code class=\"docutils literal notranslate\">HttpRequest</code><a class=\"heading-anchor\" href=\"#dictionary-access-to-httprequest\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><code class=\"docutils literal notranslate\">HttpRequest</code> objects no longer directly support dictionary-style\naccess; previously, both <code class=\"docutils literal notranslate\">GET</code> and <code class=\"docutils literal notranslate\">POST</code> data were directly\navailable on the <code class=\"docutils literal notranslate\">HttpRequest</code> object (e.g., you could check for a\npiece of form data by using <code class=\"docutils literal notranslate\">if 'some_form_key' in request</code> or by\nreading <code class=\"docutils literal notranslate\">request['some_form_key']</code>. This is no longer supported; if\nyou need access to the combined <code class=\"docutils literal notranslate\">GET</code> and <code class=\"docutils literal notranslate\">POST</code> data, use\n<code class=\"docutils literal notranslate\">request.REQUEST</code> instead.</p>\n<p>It is strongly suggested, however, that you always explicitly look in\nthe appropriate dictionary for the type of request you expect to\nreceive (<code class=\"docutils literal notranslate\">request.GET</code> or <code class=\"docutils literal notranslate\">request.POST</code>); relying on the combined\n<code class=\"docutils literal notranslate\">request.REQUEST</code> dictionary can mask the origin of incoming data.</p>\n</section>\n<section id=\"accessing-httpresponse-headers\">\n<h4>Accessing <code class=\"docutils literal notranslate\">HTTPResponse</code> headers<a class=\"heading-anchor\" href=\"#accessing-httpresponse-headers\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><code class=\"docutils literal notranslate\">django.http.HttpResponse.headers</code> has been renamed to <code class=\"docutils literal notranslate\">_headers</code> and\n<a class=\"reference internal\" href=\"/es/6.0/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a> now supports containment checking directly.\nSo use <code class=\"docutils literal notranslate\">if header in response:</code> instead of <code class=\"docutils literal notranslate\">if header in\nresponse.headers:</code>.</p>\n</section>\n</section>\n<section id=\"generic-relations\">\n<h3>Generic relations<a class=\"heading-anchor\" href=\"#generic-relations\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"generic-relations-have-been-moved-out-of-core\">\n<h4>Generic relations have been moved out of core<a class=\"heading-anchor\" href=\"#generic-relations-have-been-moved-out-of-core\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The generic relation classes – <code class=\"docutils literal notranslate\">GenericForeignKey</code> and <code class=\"docutils literal notranslate\">GenericRelation</code>\n– have moved into the <a class=\"reference internal\" href=\"/es/6.0/ref/contrib/contenttypes/#module-django.contrib.contenttypes\" title=\"django.contrib.contenttypes: Provides generic interface to installed models.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.contenttypes</code></a> module.</p>\n</section>\n</section>\n<section id=\"testing\">\n<h3>Testing<a class=\"heading-anchor\" href=\"#testing\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"django-test-client-login-has-changed\">\n<h4><a class=\"reference internal\" href=\"/es/6.0/topics/testing/tools/#django.test.Client.login\" title=\"django.test.Client.login\"><code class=\"xref py py-meth docutils literal notranslate\">django.test.Client.login()</code></a> has changed<a class=\"heading-anchor\" href=\"#django-test-client-login-has-changed\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Old (0.96):</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.test</span> <span class=\"kn\">import</span> Client\n\nc <span class=\"o\">=</span> Client<span class=\"p\">()</span>\nc<span class=\"o\">.</span>login<span class=\"p\">(</span><span class=\"s2\">&quot;/path/to/login&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;myuser&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;mypassword&quot;</span><span class=\"p\">)</span>\n</code></pre></div>\n<p>New (1.0):</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=\"c1\"># ... same as above, but then:</span>\nc<span class=\"o\">.</span>login<span class=\"p\">(</span>username<span class=\"o\">=</span><span class=\"s2\">&quot;myuser&quot;</span><span class=\"p\">,</span> password<span class=\"o\">=</span><span class=\"s2\">&quot;mypassword&quot;</span><span class=\"p\">)</span>\n</code></pre></div>\n</section>\n</section>\n<section id=\"management-commands\">\n<h3>Management commands<a class=\"heading-anchor\" href=\"#management-commands\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"running-management-commands-from-your-code\">\n<h4>Running management commands from your code<a class=\"heading-anchor\" href=\"#running-management-commands-from-your-code\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><a class=\"reference internal\" href=\"/es/6.0/howto/custom-management-commands/#module-django.core.management\" title=\"django.core.management\"><code class=\"xref py py-mod docutils literal notranslate\">django.core.management</code></a> has been greatly refactored.</p>\n<p>Calls to management services in your code now need to use\n<code class=\"docutils literal notranslate\">call_command</code>. For example, if you have some test code that calls flush and\nload_data:</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.core</span> <span class=\"kn\">import</span> management\n\nmanagement<span class=\"o\">.</span>flush<span class=\"p\">(</span>verbosity<span class=\"o\">=</span><span class=\"mi\">0</span><span class=\"p\">,</span> interactive<span class=\"o\">=</span><span class=\"kc\">False</span><span class=\"p\">)</span>\nmanagement<span class=\"o\">.</span>load_data<span class=\"p\">([</span><span class=\"s2\">&quot;test_data&quot;</span><span class=\"p\">],</span> verbosity<span class=\"o\">=</span><span class=\"mi\">0</span><span class=\"p\">)</span>\n</code></pre></div>\n<p>…you’ll need to change this code to read:</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.core</span> <span class=\"kn\">import</span> management\n\nmanagement<span class=\"o\">.</span>call_command<span class=\"p\">(</span><span class=\"s2\">&quot;flush&quot;</span><span class=\"p\">,</span> verbosity<span class=\"o\">=</span><span class=\"mi\">0</span><span class=\"p\">,</span> interactive<span class=\"o\">=</span><span class=\"kc\">False</span><span class=\"p\">)</span>\nmanagement<span class=\"o\">.</span>call_command<span class=\"p\">(</span><span class=\"s2\">&quot;loaddata&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;test_data&quot;</span><span class=\"p\">,</span> verbosity<span class=\"o\">=</span><span class=\"mi\">0</span><span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"subcommands-must-now-precede-options\">\n<h4>Subcommands must now precede options<a class=\"heading-anchor\" href=\"#subcommands-must-now-precede-options\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><code class=\"docutils literal notranslate\">django-admin.py</code> and <code class=\"docutils literal notranslate\">manage.py</code> now require subcommands to precede\noptions. So:</p>\n<div class=\"code-block\" data-language=\"console\"><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><span class=\"gp\">$ </span>django-admin.py --settings<span class=\"o\">=</span>foo.bar runserver\n</code></pre></div>\n<p>…no longer works and should be changed to:</p>\n<div class=\"code-block\" data-language=\"console\"><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><span class=\"gp\">$ </span>django-admin.py runserver --settings<span class=\"o\">=</span>foo.bar\n</code></pre></div>\n</section>\n</section>\n<section id=\"syndication\">\n<h3>Syndication<a class=\"heading-anchor\" href=\"#syndication\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"feed-init-has-changed\">\n<h4><code class=\"docutils literal notranslate\">Feed.__init__</code> has changed<a class=\"heading-anchor\" href=\"#feed-init-has-changed\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The <code class=\"docutils literal notranslate\">__init__()</code> method of the syndication framework’s <code class=\"docutils literal notranslate\">Feed</code> class now\ntakes an <code class=\"docutils literal notranslate\">HttpRequest</code> object as its second parameter, instead of the feed’s\nURL. This allows the syndication framework to work without requiring the sites\nframework. This only affects code that subclasses <code class=\"docutils literal notranslate\">Feed</code> and overrides the\n<code class=\"docutils literal notranslate\">__init__()</code> method, and code that calls <code class=\"docutils literal notranslate\">Feed.__init__()</code> directly.</p>\n</section>\n</section>\n<section id=\"data-structures\">\n<h3>Data structures<a class=\"heading-anchor\" href=\"#data-structures\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"sorteddictfromlist-is-gone\">\n<h4><code class=\"docutils literal notranslate\">SortedDictFromList</code> is gone<a class=\"heading-anchor\" href=\"#sorteddictfromlist-is-gone\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p><code class=\"docutils literal notranslate\">django.newforms.forms.SortedDictFromList</code> was removed.\n<code class=\"docutils literal notranslate\">django.utils.datastructures.SortedDict</code> can now be instantiated with\na sequence of tuples.</p>\n<p>To update your code:</p>\n<ol class=\"arabic simple\">\n<li><p>Use <code class=\"docutils literal notranslate\">django.utils.datastructures.SortedDict</code> wherever you were\nusing <code class=\"docutils literal notranslate\">django.newforms.forms.SortedDictFromList</code>.</p></li>\n<li><p>Because <code class=\"docutils literal notranslate\">django.utils.datastructures.SortedDict.copy</code> doesn’t\nreturn a deepcopy as <code class=\"docutils literal notranslate\">SortedDictFromList.copy()</code> did, you will need\nto update your code if you were relying on a deepcopy. Do this by using\n<code class=\"docutils literal notranslate\">copy.deepcopy</code> directly.</p></li>\n</ol>\n</section>\n</section>\n<section id=\"database-backend-functions\">\n<h3>Database backend functions<a class=\"heading-anchor\" href=\"#database-backend-functions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"database-backend-functions-have-been-renamed\">\n<h4>Database backend functions have been renamed<a class=\"heading-anchor\" href=\"#database-backend-functions-have-been-renamed\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Almost <em>all</em> of the database backend-level functions have been renamed and/or\nrelocated. None of these were documented, but you’ll need to change your code\nif you’re using any of these functions, all of which are in <a class=\"reference internal\" href=\"/es/6.0/topics/db/#module-django.db\" title=\"django.db\"><code class=\"xref py py-mod docutils literal notranslate\">django.db</code></a>:</p>\n<div class=\"table-scroll\" role=\"region\" tabindex=\"0\" aria-label=\"Table\"><table class=\"docutils align-default\">\n<thead>\n<tr class=\"row-odd\"><th class=\"head\"><p>Old (0.96)</p></th>\n<th class=\"head\"><p>New (1.0)</p></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_autoinc_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.autoinc_sql</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_date_extract_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.date_extract_sql</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_date_trunc_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.date_trunc_sql</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_datetime_cast_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.datetime_cast_sql</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_deferrable_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.deferrable_sql</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_drop_foreignkey_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.drop_foreignkey_sql</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_fulltext_search_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.fulltext_search_sql</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_last_insert_id</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.last_insert_id</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_limit_offset_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.limit_offset_sql</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_max_name_length</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.max_name_length</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_pk_default_value</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.pk_default_value</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_random_function_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.random_function_sql</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_sql_flush</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.sql_flush</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_sql_sequence_reset</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.sequence_reset_sql</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_start_transaction_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.start_transaction_sql</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_tablespace_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.tablespace_sql</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.quote_name</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.quote_name</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_query_set_class</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.query_set_class</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.get_field_cast_sql</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.field_cast_sql</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.get_drop_sequence</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.ops.drop_sequence_sql</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.OPERATOR_MAPPING</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.operators</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.allows_group_by_ordinal</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.allows_group_by_ordinal</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.allows_unique_and_pk</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.allows_unique_and_pk</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.autoindexes_primary_keys</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.autoindexes_primary_keys</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.needs_datetime_string_cast</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.needs_datetime_string_cast</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.needs_upper_for_iops</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.needs_upper_for_iops</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.supports_constraints</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.supports_constraints</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.supports_tablespaces</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.supports_tablespaces</code></p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">backend.uses_case_insensitive_names</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.uses_case_insensitive_names</code></p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">backend.uses_custom_queryset</code></p></td>\n<td><p><code class=\"docutils literal notranslate\">connection.features.uses_custom_queryset</code></p></td>\n</tr>\n</tbody>\n</table>\n</div>\n</section>\n</section>\n</section>","rootId":"porting-your-apps-from-django-0-96-to-1-0","toc":[{"title":"Common changes","anchor":"common-changes","children":[{"title":"Use Unicode","anchor":"use-unicode","children":[]},{"title":"Models","anchor":"models","children":[{"title":"Rename maxlength to max_length","anchor":"rename-maxlength-to-max-length","children":[]},{"title":"Replace __str__ with __unicode__","anchor":"replace-str-with-unicode","children":[]},{"title":"Remove prepopulated_from","anchor":"remove-prepopulated-from","children":[]},{"title":"Remove core","anchor":"remove-core","children":[]},{"title":"Replace class Admin: with admin.py","anchor":"replace-class-admin-with-admin-py","children":[]},{"title":"Example","anchor":"example","children":[]}]},{"title":"The Admin","anchor":"the-admin","children":[{"title":"Use new inline syntax","anchor":"use-new-inline-syntax","children":[]},{"title":"Simplify fields, or use fieldsets","anchor":"simplify-fields-or-use-fieldsets","children":[]}]},{"title":"URLs","anchor":"urls","children":[{"title":"Update your root urls.py","anchor":"update-your-root-urls-py","children":[]}]},{"title":"Views","anchor":"views","children":[{"title":"Use django.forms instead of newforms","anchor":"use-django-forms-instead-of-newforms","children":[]},{"title":"Handle uploaded files using the new API","anchor":"handle-uploaded-files-using-the-new-api","children":[]},{"title":"Work with file fields using the new API","anchor":"work-with-file-fields-using-the-new-api","children":[]},{"title":"Use Paginator instead of ObjectPaginator","anchor":"use-paginator-instead-of-objectpaginator","children":[]}]},{"title":"Templates","anchor":"templates","children":[{"title":"Learn to love autoescaping","anchor":"learn-to-love-autoescaping","children":[]}]}]},{"title":"Less-common changes","anchor":"less-common-changes","children":[{"title":"Signals","anchor":"signals","children":[]},{"title":"Comments","anchor":"comments","children":[]},{"title":"Template tags","anchor":"template-tags","children":[{"title":"spaceless tag","anchor":"spaceless-tag","children":[]}]},{"title":"Local flavors","anchor":"local-flavors","children":[{"title":"U.S. local flavor","anchor":"u-s-local-flavor","children":[]}]},{"title":"Sessions","anchor":"sessions","children":[{"title":"Getting a new session key","anchor":"getting-a-new-session-key","children":[]}]},{"title":"Fixtures","anchor":"fixtures","children":[{"title":"Loading a row no longer calls save()","anchor":"loading-a-row-no-longer-calls-save","children":[]}]},{"title":"Settings","anchor":"settings","children":[{"title":"Better exceptions","anchor":"better-exceptions","children":[]},{"title":"LOGIN_URL has moved","anchor":"login-url-has-moved","children":[]},{"title":"APPEND_SLASH behavior has been updated","anchor":"append-slash-behavior-has-been-updated","children":[]}]},{"title":"Smaller model changes","anchor":"smaller-model-changes","children":[{"title":"Different exception from get()","anchor":"different-exception-from-get","children":[]},{"title":"LazyDate has been fired","anchor":"lazydate-has-been-fired","children":[]},{"title":"DecimalField is new, and FloatField is now a proper float","anchor":"decimalfield-is-new-and-floatfield-is-now-a-proper-float","children":[]}]},{"title":"Internationalization","anchor":"internationalization","children":[{"title":"django.views.i18n.set_language() now requires a POST request","anchor":"django-views-i18n-set-language-now-requires-a-post-request","children":[]},{"title":"_() is no longer in builtins","anchor":"is-no-longer-in-builtins","children":[]}]},{"title":"HTTP request/response objects","anchor":"http-request-response-objects","children":[{"title":"Dictionary access to HttpRequest","anchor":"dictionary-access-to-httprequest","children":[]},{"title":"Accessing HTTPResponse headers","anchor":"accessing-httpresponse-headers","children":[]}]},{"title":"Generic relations","anchor":"generic-relations","children":[{"title":"Generic relations have been moved out of core","anchor":"generic-relations-have-been-moved-out-of-core","children":[]}]},{"title":"Testing","anchor":"testing","children":[{"title":"django.test.Client.login() has changed","anchor":"django-test-client-login-has-changed","children":[]}]},{"title":"Management commands","anchor":"management-commands","children":[{"title":"Running management commands from your code","anchor":"running-management-commands-from-your-code","children":[]},{"title":"Subcommands must now precede options","anchor":"subcommands-must-now-precede-options","children":[]}]},{"title":"Syndication","anchor":"syndication","children":[{"title":"Feed.__init__ has changed","anchor":"feed-init-has-changed","children":[]}]},{"title":"Data structures","anchor":"data-structures","children":[{"title":"SortedDictFromList is gone","anchor":"sorteddictfromlist-is-gone","children":[]}]},{"title":"Database backend functions","anchor":"database-backend-functions","children":[{"title":"Database backend functions have been renamed","anchor":"database-backend-functions-have-been-renamed","children":[]}]}]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/es/6.0/releases/"},{"docname":"releases/1.0","title":"Django 1.0 release notes","url":"/es/6.0/releases/1.0/"}],"prev":{"docname":"releases/1.0","title":"Django 1.0 release notes","url":"/es/6.0/releases/1.0/"},"next":{"docname":"releases/0.96","title":"Django version 0.96 release notes","url":"/es/6.0/releases/0.96/"},"formats":{"html":"/es/6.0/releases/1.0-porting-guide/","markdown":"/es/6.0/releases/1.0-porting-guide.md","json":"/es/6.0/releases/1.0-porting-guide.json"},"source":"https://github.com/django/django/blob/stable/6.0.x/docs/releases/1.0-porting-guide.txt","official":"https://docs.djangoproject.com/es/6.0/releases/1.0-porting-guide/","inVersions":["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"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}