summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorrimi0108 <hyerimc858@gmail.com>2025-10-04 13:52:59 +0900
committerJacob Walls <jacobtylerwalls@gmail.com>2025-12-03 15:04:52 -0500
commit93540b34d4ef46f68df2c8bfe90447d0f649a852 (patch)
tree93967647a5590ec653372f38cfb7123166d819c3 /docs/topics
parentddb7236b0ae9be3163c90f799fb79396e9f61cc8 (diff)
Fixed #35729 -- Enabled natural key serialization opt-out for subclasses.
Refactored serialization logic to allow models inheriting a natural_key() method (e.g. AbstractBaseUser) to explicitly opt out of natural key serialization by returning an empty tuple from the method. Thanks Jonas Dittrich for the report. Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/serialization.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/topics/serialization.txt b/docs/topics/serialization.txt
index 2b28f5e15a..f801df0561 100644
--- a/docs/topics/serialization.txt
+++ b/docs/topics/serialization.txt
@@ -638,6 +638,15 @@ command line flags to generate natural keys.
natural keys during serialization, but *not* be able to load those
key values, just don't define the ``get_by_natural_key()`` method.
+Subclasses can opt out of natural key serialization by returning an empty tuple
+(``()``) from ``natural_key()``. This tells the serializer to fall back to
+the standard primary key.
+
+.. versionchanged:: 6.1
+
+ Support for opting out of natural key serialization by returning an empty
+ tuple was added.
+
.. _natural-keys-and-forward-references:
Natural keys and forward references