diff options
| author | noFFENSE <orazkhanmansur@gmail.com> | 2023-01-18 16:56:24 +0600 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-20 10:57:47 +0100 |
| commit | 2a32d3963c974b605050688dacfe2a6ae76f52e8 (patch) | |
| tree | abcd3ac072a45e863c9d609e051a0b6a3063ca7f | |
| parent | d550e3cccd77ceaea0d77fd2df472454a238a62e (diff) | |
[4.1.x] Fixed #34242 -- Doc'd that primary key is set to None when deleting objects.
Backport of 5cd1385356d4b275133ddb0f8c78b2f37c5901eb from main
| -rw-r--r-- | docs/ref/models/fields.txt | 3 | ||||
| -rw-r--r-- | docs/ref/models/instances.txt | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 227b3ee229..3f041c5675 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -442,6 +442,9 @@ The primary key field is read-only. If you change the value of the primary key on an existing object and then save it, a new object will be created alongside the old one. +The primary key field is set to ``None`` when +:meth:`deleting <django.db.models.Model.delete>` an object. + ``unique`` ---------- diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index 0f8c330972..b93f39ae74 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -647,8 +647,9 @@ Deleting objects Issues an SQL ``DELETE`` for the object. This only deletes the object in the database; the Python instance will still exist and will still have data in -its fields. This method returns the number of objects deleted and a dictionary -with the number of deletions per object type. +its fields, except for the primary key set to ``None``. This method returns the +number of objects deleted and a dictionary with the number of deletions per +object type. For more details, including how to delete objects in bulk, see :ref:`topics-db-queries-delete`. |
