GeneratedField brings database-generated columns to Django, but when should you use it? This talk explains GeneratedField by example, with practical patterns, trade-offs, and an overview of how it evolved from Django 5.0 to 6.0 for real production use.
Database generated columns are a powerful feature, introduced in Django 5.0 with GeneratedField. A GeneratedField is computed directly by the database from other fields in the same row, so values stay consistent without triggers or extra Python code.
This talk explains GeneratedField by example, focusing on practical patterns you can use in real Django projects. Instead of a feature tour, each example answers a simple question: why use a GeneratedField here, and what are the trade-offs?
We start with small and readable cases, such as simple calculations and status fields, then move to more realistic scenarios: full names, values derived from JSON fields, and database features like full-text search vectors. Each example shows how Django expressions translate to SQL and what the database actually computes.
Since Django 5.0, GeneratedField has improved quickly. Some early limitations are no longer relevant, and the examples reflect current supported versions, including Django 5.2 LTS and Django 6.0. The talk also covers common pitfalls: stored vs virtual columns, immutability rules, backend differences, and when values need to be refreshed after saving.
You will leave with concrete recipes, a clearer mental model, and simple guidelines to decide when GeneratedField is a good choice and when other solutions are better.
I’m Paolo Melchiorre (aka paulox), a Python backend developer, Django contributor, and Python Software Foundation Fellow.
As a member of the Django Software Foundation, I serve also as a board member. Additionally, I’m a coach and organizer for Django Girls, and a navigator for the Djangonaut Space mentorship program.
In my community involvement, I organize PyCon Italia, have founded the local Python Pescara community, and am a member of the Python Italia association.
As a professional, I’m also a conference speaker, technical blogger at www.paulox.net, a GNU/Linux user, and a Free Software advocate. My academic background includes a degree in Computer Engineering from the University of Bologna.