Stable Release in branch 5.2 (LTS)
5.2.16
Released 07 Jul 2026
(1 month ago)
SoftwareDjango
Version5.2 (LTS)
StatusLTS
Supported
Supported
Python versions
Python 3.10 - 3.13
Initial release5.2
02 Apr 2025
(1 year ago)
Latest release5.2.16
07 Jul 2026
(1 month ago)
End of
mainstream support
31 Dec 2025
(Ended 7 months ago)
End of
extended support
30 Apr 2028
(Ends in 1 year, 8 months)
Release noteshttps://docs.djangoproject.com/en/5.2/releases/
Source codehttps://github.com/django/django/tree/5.2.16
Django 5.2 (LTS) ReleasesView full list

What is New in Django 5.2

Django 5.2 introduces composite primary keys, automatic model imports in the shell, and many smaller enhancements across forms, templates, and database tools. It improves customization in rendering and error handling while raising some requirements and preparing deprecations for cleaner future code.

Composite Primary Keys

Models now support primary keys made of multiple fields using the new CompositePrimaryKey class. This allows more flexible database designs without relying on surrogate keys.

from django.db.models import CompositePrimaryKey

class OrderItem(models.Model):
    order = models.ForeignKey(Order, on_delete=models.CASCADE)
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    quantity = models.PositiveIntegerField()

    class Meta:
        pk = CompositePrimaryKey('order', 'product')

Automatic Model Imports in Shell

The shell command now imports models from all installed apps by default. This saves time when exploring data interactively. Details appear at higher verbosity levels, and you can customize the behavior.

Customizing BoundField Rendering

Override BoundField more easily at project, form, or field levels with new class attributes. This simplifies creating custom form widgets and layouts.

Forms and Widgets

  • New input widgets: ColorInput, SearchInput, and TelInput.
  • ErrorList supports custom HTML IDs.
  • BoundField adds aria_describedby for better accessibility.
  • Custom attributes for JavaScript in form media via Script asset.

Database and Models

  • AlterConstraint migration operation to modify constraints without dropping them.
  • New JSONArray database function.
  • Support for curved geometries in GDAL.
  • MySQL gains coveredby and covers lookups.
  • QuerySet.values() and values_list() respect expression order.
  • CharField.max_length optional on SQLite.

Admin and Templates

  • New extrabody block in admin base.html.
  • URLField values render as clickable links.
  • Custom link text in docstrings.
  • Model docs restricted by permissions.
  • simple_block_tag() decorator for easy block tags.

Other Improvements

  • Async support in auth backends.
  • Custom error messages in password validators.
  • Stronger default PBKDF2 iterations.
  • Connection pools for Oracle.
  • Async view methods with method_decorator().
  • Improved email attachment handling.
  • Better reverse URL with query and fragment args.

Backward Incompatible Changes

  • Dropped support for PostgreSQL 13 (now requires 14+).
  • MySQL defaults to utf8mb4 charset.
  • Changes in email attachments and alternatives handling.
  • Stricter aggregate argument checks.
  • Removed fallbacks in auth when user is None.

Deprecations

  • Fallbacks to request.user in auth functions.
  • ordering in some PostgreSQL aggregates.
  • Some static files finder arguments.

Why Upgrade to Django 5.2

Django 5.2 adds powerful tools like composite keys and better form customization while keeping projects stable. It enhances database features, security, and developer convenience, making it a great choice for modern web applications.

Releases In Branch 5.2 (LTS)

VersionRelease date
5.2.1607 Jul 2026
(1 month ago)
5.2.1503 Jun 2026
(2 months ago)
5.2.1405 May 2026
(3 months ago)
5.2.1307 Apr 2026
(4 months ago)
5.2.1203 Mar 2026
(5 months ago)
5.2.1103 Feb 2026
(6 months ago)
5.2.1006 Jan 2026
(7 months ago)
5.2.902 Dec 2025
(8 months ago)
5.2.805 Nov 2025
(9 months ago)
5.2.701 Oct 2025
(10 months ago)
5.2.603 Sep 2025
(11 months ago)
5.2.506 Aug 2025
(1 year ago)
5.2.402 Jul 2025
(1 year ago)
5.2.310 Jun 2025
(1 year ago)
5.2.204 Jun 2025
(1 year ago)
5.2.107 May 2025
(1 year ago)
5.202 Apr 2025
(1 year ago)
5.2rc119 Mar 2025
(1 year ago)
5.2b119 Feb 2025
(1 year ago)
5.2a116 Jan 2025
(1 year ago)