{"title":"Django 4.2.1 release notes","version":"dev","locale":"en","docname":"releases/4.2.1","url":"/en/dev/releases/4.2.1/","canonical":"https://djangodocs.dev/en/dev/releases/4.2.1/","summary":"Django 4.2.1 fixes a security issue with severity “low” and several bugs in 4.2.","html":"<h1>Django 4.2.1 release notes<a class=\"heading-anchor\" href=\"#django-4-2-1-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>May 3, 2023</em></p>\n<p>Django 4.2.1 fixes a security issue with severity “low” and several bugs in\n4.2.</p>\n<section id=\"cve-2023-31047-potential-bypass-of-validation-when-uploading-multiple-files-using-one-form-field\">\n<h2>CVE-2023-31047: Potential bypass of validation when uploading multiple files using one form field<a class=\"heading-anchor\" href=\"#cve-2023-31047-potential-bypass-of-validation-when-uploading-multiple-files-using-one-form-field\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Uploading multiple files using one form field has never been supported by\n<a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.FileField\" title=\"django.forms.FileField\"><code class=\"xref py py-class docutils literal notranslate\">forms.FileField</code></a> or <a class=\"reference internal\" href=\"/en/dev/ref/forms/fields/#django.forms.ImageField\" title=\"django.forms.ImageField\"><code class=\"xref py py-class docutils literal notranslate\">forms.ImageField</code></a> as only the last\nuploaded file was validated. Unfortunately, <a class=\"reference internal\" href=\"/en/dev/topics/http/file-uploads/#uploading-multiple-files\"><span class=\"std std-ref\">Uploading multiple files</span></a>\ntopic suggested otherwise.</p>\n<p>In order to avoid the vulnerability, <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>\nand <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> form widgets now raise <code class=\"docutils literal notranslate\">ValueError</code> when\nthe <code class=\"docutils literal notranslate\">multiple</code> HTML attribute is set on them. To prevent the exception and\nkeep the old behavior, set <code class=\"docutils literal notranslate\">allow_multiple_selected</code> to <code class=\"docutils literal notranslate\">True</code>.</p>\n<p>For more details on using the new attribute and handling of multiple files\nthrough a single field, see <a class=\"reference internal\" href=\"/en/dev/topics/http/file-uploads/#uploading-multiple-files\"><span class=\"std std-ref\">Uploading multiple files</span></a>.</p>\n</section>\n<section id=\"bugfixes\">\n<h2>Bugfixes<a class=\"heading-anchor\" href=\"#bugfixes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul class=\"simple\">\n<li><p>Fixed a regression in Django 4.2 that caused a crash of <code class=\"docutils literal notranslate\">QuerySet.defer()</code>\nwhen deferring fields by attribute names (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34458\">#34458</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 that caused a crash of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/search/#django.contrib.postgres.search.SearchVector\" title=\"django.contrib.postgres.search.SearchVector\"><code class=\"xref py py-class docutils literal notranslate\">SearchVector</code></a> function with <code class=\"docutils literal notranslate\">%</code>\ncharacters (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34459\">#34459</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 that caused aggregation over query that\nuses explicit grouping to group against the wrong columns (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34464\">#34464</a>).</p></li>\n<li><p>Reallowed, following a regression in Django 4.2, setting the\n<code class=\"docutils literal notranslate\">&quot;cursor_factory&quot;</code> option in <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-OPTIONS\"><code class=\"xref std std-setting docutils literal notranslate\">OPTIONS</code></a> on PostgreSQL\n(<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34466\">#34466</a>).</p></li>\n<li><p>Enforced UTF-8 client encoding on PostgreSQL, following a regression in\nDjango 4.2 (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34470\">#34470</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 where <code class=\"docutils literal notranslate\">i18n_patterns()</code> didn’t respect the\n<code class=\"docutils literal notranslate\">prefix_default_language</code> argument when a fallback language of the default\nlanguage was used (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34455\">#34455</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 where translated URLs of the default\nlanguage from <code class=\"docutils literal notranslate\">i18n_patterns()</code> with <code class=\"docutils literal notranslate\">prefix_default_language</code> set to\n<code class=\"docutils literal notranslate\">False</code> raised 404 errors for a request with a different language\n(<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34515\">#34515</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 where creating copies and deep copies of\n<code class=\"docutils literal notranslate\">HttpRequest</code>, <code class=\"docutils literal notranslate\">HttpResponse</code>, and their subclasses didn’t always work\ncorrectly (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34482\">#34482</a>, <a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34484\">#34484</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 where <code class=\"docutils literal notranslate\">timesince</code> and <code class=\"docutils literal notranslate\">timeuntil</code>\ntemplate filters returned incorrect results for a datetime with a non-UTC\ntimezone when a time difference is less than 1 day (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34483\">#34483</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 that caused a crash of\n<a class=\"reference internal\" href=\"/en/dev/ref/contrib/postgres/search/#django.contrib.postgres.search.SearchHeadline\" title=\"django.contrib.postgres.search.SearchHeadline\"><code class=\"xref py py-class docutils literal notranslate\">SearchHeadline</code></a> function with\n<code class=\"docutils literal notranslate\">psycopg</code> 3 (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34486\">#34486</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 that caused incorrect <code class=\"docutils literal notranslate\">ClearableFileInput</code>\nmargins in the admin (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34506\">#34506</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 where breadcrumbs didn’t appear on admin\nsite app index views (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34512\">#34512</a>).</p></li>\n<li><p>Made squashing migrations reduce <code class=\"docutils literal notranslate\">AddIndex</code>, <code class=\"docutils literal notranslate\">RemoveIndex</code>,\n<code class=\"docutils literal notranslate\">RenameIndex</code>, and <code class=\"docutils literal notranslate\">CreateModel</code> operations which allows removing a\ndeprecated <code class=\"docutils literal notranslate\">Meta.index_together</code> option from historical migrations and use\n<code class=\"docutils literal notranslate\">Meta.indexes</code> instead (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34525\">#34525</a>).</p></li>\n</ul>\n</section>","rootId":"django-4-2-1-release-notes","toc":[{"title":"CVE-2023-31047: Potential bypass of validation when uploading multiple files using one form field","anchor":"cve-2023-31047-potential-bypass-of-validation-when-uploading-multiple-files-using-one-form-field","children":[]},{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/4.2.2","title":"Django 4.2.2 release notes","url":"/en/dev/releases/4.2.2/"},"next":{"docname":"releases/4.2","title":"Django 4.2 release notes","url":"/en/dev/releases/4.2/"},"formats":{"html":"/en/dev/releases/4.2.1/","markdown":"/en/dev/releases/4.2.1.md","json":"/en/dev/releases/4.2.1.json"},"source":"https://github.com/django/django/blob/main/docs/releases/4.2.1.txt","official":"https://docs.djangoproject.com/en/dev/releases/4.2.1/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2"],"inLocales":["en"]}