summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVIZZARD-X <vigneshanandmay13@gmail.com>2025-11-22 12:05:35 +0530
committerJacob Walls <jacobtylerwalls@gmail.com>2026-03-28 13:40:35 -0400
commit00f0b0d233e4197227d05cb1fe55855100d415ad (patch)
tree2dfacf902992d47ce73451b817368eea058733aa
parent4a21ba2210ee5b1e650f6b0faa75c9d635c6cdbc (diff)
[6.0.x] Fixed #29762 -- Doc'd how database routers fetch related objects.
Thanks James Bligh for the review. Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com> Backport of edd899786851f6285abbc3c272f4f5ec0e48a74c from main.
-rw-r--r--docs/topics/db/multi-db.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/topics/db/multi-db.txt b/docs/topics/db/multi-db.txt
index 38f91c2800..5e423d4981 100644
--- a/docs/topics/db/multi-db.txt
+++ b/docs/topics/db/multi-db.txt
@@ -232,6 +232,12 @@ cases, no instance hint will be provided at all. The router checks for
the existence of an instance hint, and determine if that hint should be
used to alter routing behavior.
+If an ``instance`` hint is present, the database from which it was fetched
+is recorded on its :attr:`instance._state.db <django.db.models.Model._state>`.
+Routers will need to first consult that attribute before falling back to any
+fixed alias to match Django's default behavior of fetching related instances
+from the same database.
+
Using routers
-------------