Skip to content

Conversation

@VIZZARD-X
Copy link
Contributor

Trac ticket number

ticket-29762

Branch description

This PR documents how Django selects the database for related-object access in multi-database configurations.
Django records the originating database on instance._state.db and uses it for related lookups.
When a database router overrides db_for_read() without considering the instance hint, this default behavior is lost, which can cause errors in multi-schema setups.
The patch adds a section explaining the default behavior, the use of hints, and how routers should preserve correct routing.

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

@VIZZARD-X VIZZARD-X force-pushed the ticket-29762-multi-db-router-docs branch 2 times, most recently from 3c48c88 to 7461c48 Compare November 22, 2025 06:22
@VIZZARD-X VIZZARD-X force-pushed the ticket-29762-multi-db-router-docs branch from 7461c48 to 0fbe32f Compare November 22, 2025 06:35
@VIZZARD-X VIZZARD-X closed this by deleting the head repository Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant