diff options
| author | VIZZARD-X <vigneshanandmay13@gmail.com> | 2025-11-22 12:05:35 +0530 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-03-28 13:40:09 -0400 |
| commit | edd899786851f6285abbc3c272f4f5ec0e48a74c (patch) | |
| tree | 102e286595ee57c41446d37324a86afd6aea65fc /docs | |
| parent | 4fd9e85b6031e7ddf878b280f324da6b98f7b0ed (diff) | |
Fixed #29762 -- Doc'd how database routers fetch related objects.
Thanks James Bligh for the review.
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/db/multi-db.txt | 6 |
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 ------------- |
