DEV Community

Cover image for Django 5.0 is here
tanish vashisth
tanish vashisth

Posted on

Django 5.0 is here

Django 5.0 is released 🎉🎉🎉

Lot of exiting changes to DjangoORM and more..

Let's take a brief look at what's new.

  • Generated fields

The new GeneratedField enables the creation of database-generated fields, where values are automatically computed by the database itself based on other fields (and indexable too). For example, if you have first_name and last_name fields, you can use a GeneratedField to create a full_name property that is a combination of the two, allowing the database to handle the generation process.

  • Database-computed default values

This was the last significant obstacle to fully representing the structure of Django models in the database schema. In Django versions prior to 5.0, the only option for setting a default value for a field was through Field.default, and it was calculated on the Python side, not in the database. The new Field.db_default option addresses this limitation by allowing the creation of default values directly in the database schema, providing a valuable improvement for consistency

  • Form field group rendering

The new concept of form field group rendering makes field rendering simpler and more reusable. Now you can use filed.as_field_group to render separate fields without any inconsistencies.

Top comments (0)