The Django project has released version 5.0 of this popular web application framework for Python, including improvements to ORM (Object-relational mapper) features, simplified form templates, and support for Python 3.10, 3.11 and 3.12.
A post from release manager Natalia Bidart references “a deluge of exciting new features” which seems an exaggeration; but the additional functionality is valuable and focused on small things that matter, in keeping with the careful approach that characterises the project.
New in Django 5.0, field groups and field group templates enable more concise coding of forms. Laying out form elements with labels, input elements, help text and error display can be tedious and using templates makes for faster work and greater consistency. Default templates are supplied and can be customized.
On the ORM side, it is now possible to create calculated columns, or fields that are computed from other fields. In Django this is called a GeneratedField.
Another new feature lets developers add database-computed default values by using the db_default keyword in the model definition. The release notes cover all the changes including better support for async code, which has been gradually improving with each new version.
Django is now 20 years old. Co-creator Simon Willison wrote that “Django started when Adrian Holovaty and I were working together for a year at the Lawrence Journal-World newspaper back in 2003-2004” and that it came about because “both of us were fed up with trying to maintain large sites in PHP,” though he acknowledged that it “might be better now.” Django was influenced by “strong opinions about how web development should work” including well-designed URLs and good use of CSS, as well as ensuring good performance at scale. Django is open source under the BSD license, and owned by the non-profit Django Software Foundation.
The 2023 StackOverflow survey positioned Django with an 11.47 percent take-up from respondents, just below Flask, another common choice for Python, at 12.16 percent. Developers like its stability. “I deeply appreciate how it gives me enough abstraction to get going but doesn’t get too far ahead of itself. If I go away for a year or two then come back I still get what’s going on. Meanwhile anything I try on JS land has gone through a few half-lives,” said one developer.
The Django release cycle designates certain releases as LTS (Long-term support), which typically means three years. The LTS release is generally the second feature release after the major version bump, with feature releases coming every 8 months. We can therefore expect version 5.1 in August 2024 and 5.2 LTS around April 2025.