• Language: en
  • Documentation version: development

Django 5.2 release notes - UNDER DEVELOPMENT

Expected April 2025

Welcome to Django 5.2!

These release notes cover the new features, as well as some backwards incompatible changes you should be aware of when upgrading from Django 5.1 or earlier. We’ve begun the deprecation process for some features.

See the How to upgrade Django to a newer version guide if you’re updating an existing project.

Django 5.2 is designated as a long-term support release. It will receive security updates for at least three years after its release. Support for the previous LTS, Django 4.2, will end in April 2026.

Python compatibility

Django 5.2 supports Python 3.10, 3.11, 3.12, and 3.13. We highly recommend and only officially support the latest release of each series.

What’s new in Django 5.2

Minor features

django.contrib.admin

  • The admin/base.html template now has a new block extrabody for adding custom code before the closing </body> tag.

django.contrib.auth

  • The default iteration count for the PBKDF2 password hasher is increased from 870,000 to 1,000,000.

django.contrib.syndication

  • All SyndicationFeed classes now support a stylesheets attribute. If specified, an <? xml-stylesheet ?> processing instruction will be added to the top of the document for each stylesheet in the given list. See Feed stylesheets for more details.

Asynchronous views

Cache

CSRF

Database backends

Decorators

Email

Error Reporting

File Storage

File Uploads

Forms

  • The new ColorInput form widget is for entering a color in rrggbb hexadecimal format and renders as <input type="color" ...>. Some browsers support a visual color picker interface for this input type.
  • The new SearchInput form widget is for entering search queries and renders as <input type="search" ...>.
  • The new TelInput form widget is for entering telephone numbers and renders as <input type="tel" ...>.

Generic Views

Internationalization

Logging

Management Commands

  • A new warning is printed to the console when running runserver that runserver is unsuitable for production. This warning can be hidden by setting the HIDE_PRODUCTION_WARNING environment variable to "true".

Migrations

Models

  • The SELECT clause generated when using QuerySet.values() and values_list() now matches the specified order of the referenced expressions. Previously the order was based of a set of counterintuitive rules which made query combination through methods such as QuerySet.union() unpredictable.
  • Added support for validation of model constraints which use a GeneratedField.
  • The new Expression.set_returning attribute specifies that the expression contains a set-returning function, enforcing subquery evaluation. This is necessary for many Postgres set-returning functions.
  • CharField.max_length is no longer required to be set on SQLite, which supports unlimited VARCHAR columns.

Requests and Responses

Security

Serialization

  • Each serialization format now defines a Deserializer class, rather than a function, to improve extensibility when defining a custom serialization format.

Signals

Templates

Tests

  • Stack frames from Django’s custom assertions are now hidden. This makes test failures easier to read and enables test --pdb to directly enter into the failing test method.
  • Data loaded from fixtures and from migrations enabled with serialized_rollback=True are now available during TransactionTestCase.setUpClass().

URLs

Utilities

  • SafeString now returns NotImplemented in __add__ for non-string right-hand side values. This aligns with the str addition behavior and allows __radd__ to be used if available.
  • format_html_join() now supports taking an iterable of mappings, passing their contents as keyword arguments to format_html().

Validators

Backwards incompatible changes in 5.2

Database backend API

This section describes changes that may be needed in third-party database backends.

  • The new Model._is_pk_set() method allows checking if a Model instance’s primary key is defined.

django.contrib.gis

  • Support for PostGIS 3.0 is removed.

Dropped support for PostgreSQL 13

Upstream support for PostgreSQL 13 ends in November 2025. Django 5.2 supports PostgreSQL 14 and higher.

Miscellaneous

  • Adding EmailMultiAlternatives.alternatives is now only supported via the attach_alternative() method.
  • The minimum supported version of gettext is increased from 0.15 to 0.19.
  • HttpRequest.accepted_types is now sorted by the client’s preference, based on the request’s Accept header.

Features deprecated in 5.2

Miscellaneous

  • The all argument for the django.contrib.staticfiles.finders.find() function is deprecated in favor of the find_all argument.
Back to Top