summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorCsirmaz Bendegúz <csirmazbendeguz@gmail.com>2024-09-10 04:46:50 +0800
committerGitHub <noreply@github.com>2024-09-09 17:46:50 -0300
commit5865ff5adcf64da03d306dc32b36e87ae6927c85 (patch)
tree6fde8c074dc1ec5dab5db7c045f0ef40e649b719 /docs
parentcdbd31960e0cf41063b3efac97292ee0ccc262bb (diff)
Refs #373 -- Added Model._is_pk_set() abstraction to check if a Model's PK is set.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/instances.txt11
-rw-r--r--docs/releases/5.2.txt4
2 files changed, 14 insertions, 1 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index e1011ded66..57ebaf8e17 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -973,3 +973,14 @@ Other attributes
since they are yet to be saved. Instances fetched from a ``QuerySet``
will have ``adding=False`` and ``db`` set to the alias of the associated
database.
+
+``_is_pk_set()``
+----------------
+
+.. method:: Model._is_pk_set()
+
+.. versionadded:: 5.2
+
+The ``_is_pk_set()`` method returns whether the model instance's ``pk`` is set.
+It abstracts the model's primary key definition, ensuring consistent behavior
+regardless of the specific ``pk`` configuration.
diff --git a/docs/releases/5.2.txt b/docs/releases/5.2.txt
index 3dd7b00b29..09d1dff49a 100644
--- a/docs/releases/5.2.txt
+++ b/docs/releases/5.2.txt
@@ -289,7 +289,9 @@ Database backend API
This section describes changes that may be needed in third-party database
backends.
-* ...
+* The new :meth:`Model._is_pk_set() <django.db.models.Model._is_pk_set>` method
+ allows checking if a Model instance's primary key is defined.
+
:mod:`django.contrib.gis`
-------------------------