| in blog | Simon Willison's Weblog: django |
|---|---|
| original entry | Composite primary keys in Django |
Composite primary keys in Django
Django 5.2 is out today and a big new feature is composite primary keys, which can now be defined like this:class Release(models.Model): pk = models.CompositePrimaryKey( "version", "name" ) version = models.IntegerField() name = models.CharField(max_length=20)
They don't yet work with the Django admin or as targets for foreign keys.
Other smaller new features include:
./manage.py shell - a feature borrowed from ./manage.py shell_plus in django-extensionsresponse.content.decode("utf-8") any more5.2 is also an LTS release, so it will receive security and data loss bug fixes up to April 2028.