Django 5.2 Adds Composite Key Support
Written by Kay Ewbank   
Monday, 07 April 2025

Django 5.2 has been released with the addition of support for composite primary keys, and the automatic importing of all models in the shell by default.

Django is a high-level Python web framework for creating full stack dynamic websites. It is free and open-source, and the developers say it encourages rapid development and clean, pragmatic design, and that it takes care of much of the hassle of web development, so you can focus on writing your app. 

django

One of the main changes in this release is the addition of support for composite primary keys. There's a new django.db.models.CompositePrimaryKey that allows tables to be created with a primary key consisting of multiple fields.

Another improvement means that all models from installed apps are automatically imported into the shell environment. Models from apps listed earlier in INSTALLED_APPS take precedence.

When Django 5 was released, it brought in simplified templates for form field rendering, with the addition of a field group and field group templates. This simplifies rendering of the related elements of a Django form field such as its label, widget, help text, and errors, and significantly reduces the amount of HTML and template code needed to render form elements, making your templates cleaner and more maintainable. The update to version 5.2 makes it easier to override a BoundField, as this can now be set on a form, field or project level.

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. In terms of Python compatibility, Django 5.2 supports Python 3.10, 3.11, 3.12, and 3.13.

With the release of Django 5.2, Django 5.1 has reached the end of mainstream support. The final minor bug fix release, 5.1.8, which was also a security release, has now been issued. Django 5.1 will receive security and data loss fixes until December 2025. The new version also marks the end of extended support for Django 5.0. 

Django 5.2 is available now.  

 django

More Information

Django Project Website

Related Articles

Welcoming Django 4

Django 4 Beta 1 Released

Django 3 Adds Support For ASGI

Django 1.3 released

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Microsoft Announces Hyperlight Wasm
01/04/2025

Microsoft has released Hyperlight Wasm, a Hyperlight virtual machine (VM) "micro-guest" that can run Wasm component workloads written in many programming languages.



GitHub Splits Advanced Security Into Separate Products
24/03/2025

GitHub has announced that from April 1, GitHub Advanced Security will be available as two standalone security products - GitHub Secret Protection and GitHub Code Security. 


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info