From 978aae4334fa71ba78a3e94408f0f3aebde8d07c Mon Sep 17 00:00:00 2001 From: Bendeguz Csirmaz Date: Sun, 7 Apr 2024 10:32:16 +0800 Subject: Fixed #373 -- Added CompositePrimaryKey. Thanks Lily Foote and Simon Charette for reviews and mentoring this Google Summer of Code 2024 project. Co-authored-by: Simon Charette Co-authored-by: Lily Foote --- docs/ref/models/fields.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'docs/ref/models') diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 07e86785d9..5b0f127c6f 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -707,6 +707,23 @@ or :class:`~django.forms.NullBooleanSelect` if :attr:`null=True `. The default value of ``BooleanField`` is ``None`` when :attr:`Field.default` isn't defined. +``CompositePrimaryKey`` +----------------------- + +.. versionadded:: 5.2 + +.. class:: CompositePrimaryKey(*field_names, **options) + +A virtual field used for defining a composite primary key. + +This field must be defined as the model's ``pk`` field. If present, Django will +create the underlying model table with a composite primary key. + +The ``*field_names`` argument is a list of positional field names that compose +the primary key. + +See :doc:`/topics/composite-primary-key` for more details. + ``CharField`` ------------- @@ -1615,6 +1632,8 @@ not an instance of ``UUID``. hyphens, because PostgreSQL and MariaDB 10.7+ store them in a hyphenated uuid datatype type. +.. _relationship-fields: + Relationship fields =================== -- cgit v1.3