{"title":"Django 5.0.5 release notes","version":"dev","locale":"en","docname":"releases/5.0.5","url":"/en/dev/releases/5.0.5/","canonical":"https://djangodocs.dev/en/dev/releases/5.0.5/","summary":"Django 5.0.5 fixes several bugs in 5.0.4. Fixed a bug in Django 5.0 that caused a crash of Model.save() when creating an instance of a model with a…","html":"<h1>Django 5.0.5 release notes<a class=\"heading-anchor\" href=\"#django-5-0-5-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>May 6, 2024</em></p>\n<p>Django 5.0.5 fixes several bugs in 5.0.4.</p>\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 bug in Django 5.0 that caused a crash of <code class=\"docutils literal notranslate\">Model.save()</code> when\ncreating an instance of a model with a <code class=\"docutils literal notranslate\">GeneratedField</code> and providing a\nprimary key (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35350\">#35350</a>).</p></li>\n<li><p>Fixed a compatibility issue encountered in Python 3.11.9+ and 3.12.3+ when\nvalidating email max line lengths with content decoded using the\n<code class=\"docutils literal notranslate\">surrogateescape</code> error handling scheme (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35361\">#35361</a>).</p></li>\n<li><p>Fixed a bug in Django 5.0 that caused a crash when applying migrations\nincluding alterations to <code class=\"docutils literal notranslate\">GeneratedField</code> such as setting <code class=\"docutils literal notranslate\">db_index=True</code>\non SQLite (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35373\">#35373</a>).</p></li>\n<li><p>Allowed importing <code class=\"docutils literal notranslate\">aprefetch_related_objects</code> from <code class=\"docutils literal notranslate\">django.db.models</code>\n(<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35392\">#35392</a>).</p></li>\n<li><p>Fixed a bug in Django 5.0 that caused a migration crash when a\n<code class=\"docutils literal notranslate\">GeneratedField</code> was added before any of the referenced fields from its\n<code class=\"docutils literal notranslate\">expression</code> definition (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35359\">#35359</a>).</p></li>\n<li><p>Fixed a bug in Django 5.0 that caused a migration crash when altering a\n<code class=\"docutils literal notranslate\">GeneratedField</code> referencing a renamed field (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35422\">#35422</a>).</p></li>\n<li><p>Fixed a bug in Django 5.0 where the <code class=\"docutils literal notranslate\">querysets</code> argument of\n<code class=\"docutils literal notranslate\">GenericPrefetch</code> was not required (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35426\">#35426</a>).</p></li>\n</ul>\n</section>","rootId":"django-5-0-5-release-notes","toc":[{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/5.0.6","title":"Django 5.0.6 release notes","url":"/en/dev/releases/5.0.6/"},"next":{"docname":"releases/5.0.4","title":"Django 5.0.4 release notes","url":"/en/dev/releases/5.0.4/"},"formats":{"html":"/en/dev/releases/5.0.5/","markdown":"/en/dev/releases/5.0.5.md","json":"/en/dev/releases/5.0.5.json"},"source":"https://github.com/django/django/blob/main/docs/releases/5.0.5.txt","official":"https://docs.djangoproject.com/en/dev/releases/5.0.5/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0"],"inLocales":["en"]}