summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2026-07-29 18:06:19 -0400
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2026-07-31 09:52:35 +0200
commit902e5c0fb2d3f0772efbfebc8ff135926a2bb47a (patch)
treea49886f66fe335faab69cef28db3a388782f58f6 /docs
parent9465349120ef8a0b0689e12bcbfd05f3d173ebdf (diff)
Refs #37139 -- Doc'd _is_pk_set() handling of DatabaseDefault.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/instances.txt12
-rw-r--r--docs/releases/6.1.txt3
2 files changed, 12 insertions, 3 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index 429be8ac0c..a0dbc0f6b5 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -996,6 +996,12 @@ Other attributes
.. method:: Model._is_pk_set()
-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.
+ 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. A
+ ``DatabaseDefault`` on an unsaved instance is considered unset.
+
+ .. versionchanged:: 6.1
+
+ In earlier versions, ``True`` was returned for ``DatabaseDefault``
+ values.
diff --git a/docs/releases/6.1.txt b/docs/releases/6.1.txt
index 4316a00dba..72251bf38b 100644
--- a/docs/releases/6.1.txt
+++ b/docs/releases/6.1.txt
@@ -508,6 +508,9 @@ Models
using :class:`.RawSQL`, might have to be adjusted to also make use of
quoting.
+* :meth:`~django.db.models.Model._is_pk_set` now returns ``False`` for
+ ``DatabaseDefault`` values on unsaved instances.
+
System checks
-------------