From 5865ff5adcf64da03d306dc32b36e87ae6927c85 Mon Sep 17 00:00:00 2001 From: Csirmaz Bendegúz Date: Tue, 10 Sep 2024 04:46:50 +0800 Subject: Refs #373 -- Added Model._is_pk_set() abstraction to check if a Model's PK is set. --- docs/ref/models/instances.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs/ref') 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. -- cgit v1.3