diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-01-14 16:43:49 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-01-15 13:44:23 +0100 |
| commit | f054045973ea767ee4e3d60723de4a2f13bf0c49 (patch) | |
| tree | d9f2769bb7aef7ad9a2bf339eaf926bc39b7600d /docs/topics | |
| parent | b721f127603516c75ebda6912046ff5f0694e150 (diff) | |
Refs #36070 -- Referred to pk as an attribute when a composite primary key is defined.
This is to avoid confusion that a field is often associated with having
a single associated database column.
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/composite-primary-key.txt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/topics/composite-primary-key.txt b/docs/topics/composite-primary-key.txt index b43df68dfc..883c1b3e6f 100644 --- a/docs/topics/composite-primary-key.txt +++ b/docs/topics/composite-primary-key.txt @@ -11,8 +11,8 @@ In most cases, a single primary key should suffice. In database design, however, defining a primary key consisting of multiple fields is sometimes necessary. -To use a composite primary key, when creating a model set the ``pk`` field to -be a :class:`.CompositePrimaryKey`:: +To use a composite primary key, when defining a model set the ``pk`` attribute +to be a :class:`.CompositePrimaryKey`:: class Product(models.Model): name = models.CharField(max_length=100) @@ -41,8 +41,8 @@ A composite primary key is represented by a ``tuple``: >>> item.pk (1, "A755H") -You can assign a ``tuple`` to a composite primary key. This sets the associated -field values. +You can assign a ``tuple`` to the :attr:`~django.db.models.Model.pk` attribute. +This sets the associated field values: .. code-block:: pycon |
