4.2.27

Latest release in branch 4.2
Released 1 month ago (December 02, 2025)

Software Django
Branch 4.2
Status LTS
Supported
End of mainstream support December 04, 2023
End of extended support April 30, 2026
First official release version 4.2
First official release date 2 years ago (April 03, 2023)
Supported
Python versions
Python 3.8 - 3.12
Release notes https://docs.djangoproject.com/en/4.2/releases/
Documentation https://docs.djangoproject.com/en/4.2/
Django 4.2 Releases View full list

What is New in Django 4.2

Django 4.2 is a feature release that adds support for Psycopg 3, new options for database comments, and a customizable file storage system. It improves the admin interface with themes and better widgets, enhances GIS and PostgreSQL capabilities, and includes security updates like BREACH mitigation. Several deprecations prepare for future changes, along with some backward incompatible updates.

Psycopg 3 Support

Django now works with the modern psycopg library version 3.1.8 or higher. The database engine setting stays the same, supporting both Psycopg 2 and 3. Note that Psycopg 3 has some differences from version 2.

Database Comments

Add descriptive comments to columns and tables directly in models.

class Question(models.Model):
    text = models.TextField(db_comment="Poll question")
    pub_date = models.DateTimeField(db_comment="Date and time when the question was published")

    class Meta:
        db_table_comment = "Poll questions"

Migrations support changing these comments.

Custom File Storages

The new STORAGES setting lets you define multiple backends for default files and static files. It replaces the old DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings.

Admin Interface Updates

  • Light and dark theme toggle, including automatic system preference detection.
  • Uses system fonts for faster loading.
  • Filter widgets in changelists are now searchable.
  • Editable lists use atomic transactions for safety.
  • New blocks in templates for easier customization.

GIS Improvements

  • GeoJSON serialization includes an id key.
  • New isempty lookup for empty geometries on PostGIS.
  • Support for pathlib.Path in GDALRaster.
  • Updated OpenLayers widget to version 7.2.2.

Security Enhancements

  • GZipMiddleware adds random bytes to responses to protect against BREACH attacks.
  • Default PBKDF2 password hasher uses more iterations for stronger security.

Other Notable Features

  • In-memory storage for faster testing.
  • Async support in streaming responses.
  • New PostgreSQL lookups like trigram_strict_word_similar.
  • Improved error reporting with exception notes on Python 3.11+.
  • Central Kurdish language support.

Deprecations

  • index_together model option; use indexes instead.
  • Passing encoded JSON strings to JSONField.
  • Some password hashers and case-insensitive fields.
  • Old file storage settings.
  • Various APIs and template filters.

Backward Incompatible Changes

Area Change
Database Support Dropped MariaDB 10.3, MySQL 5.7, and PostgreSQL 11
Model Save update_or_create() passes update_fields to save()
MySQL Aggregations Raw SQL aggregations no longer allowed in GROUP BY
User Forms UserCreationForm handles many-to-many fields and stricter username checks

Why Upgrade to Django 4.2

Django 4.2 brings modern database support, better admin usability, and stronger security. It offers tools for cleaner code and faster development while maintaining stability. This release is a solid step forward for projects needing updated features and performance.

Releases In Branch 4.2

Version Release date
4.2.27 1 month ago
(December 02, 2025)
4.2.26 2 months ago
(November 05, 2025)
4.2.25 3 months ago
(October 01, 2025)
4.2.24 4 months ago
(September 03, 2025)
4.2.23 7 months ago
(June 10, 2025)
4.2.22 7 months ago
(June 04, 2025)
4.2.21 8 months ago
(May 07, 2025)
4.2.20 10 months ago
(March 06, 2025)
4.2.19 11 months ago
(February 05, 2025)
4.2.18 11 months ago
(January 14, 2025)
4.2.17 1 year ago
(December 04, 2024)
4.2.16 1 year ago
(September 03, 2024)
4.2.15 1 year ago
(August 06, 2024)
4.2.14 1 year ago
(July 09, 2024)
4.2.13 1 year ago
(May 07, 2024)
4.2.12 1 year ago
(May 06, 2024)
4.2.11 1 year ago
(March 04, 2024)
4.2.10 1 year ago
(February 06, 2024)
4.2.9 2 years ago
(January 02, 2024)
4.2.8 2 years ago
(December 04, 2023)
4.2.7 2 years ago
(November 01, 2023)
4.2.6 2 years ago
(October 04, 2023)
4.2.5 2 years ago
(September 04, 2023)
4.2.4 2 years ago
(August 01, 2023)
4.2.3 2 years ago
(July 03, 2023)
4.2.2 2 years ago
(June 05, 2023)
4.2.1 2 years ago
(May 03, 2023)
4.2 2 years ago
(April 03, 2023)
4.2rc1 2 years ago
(March 20, 2023)
4.2b1 2 years ago
(February 20, 2023)
4.2a1 2 years ago
(January 17, 2023)