﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16240	Querying models with foreign keys in multidb doesn't use right DB	aviv.by@…	nobody	"I've got a setup with multidb and a router that splits traffic between two connections by tables.
The problem I'm seeing is that, say I've got a Book model that has a foreign key to an Author model, and each one is managed in a different DB connection (as is decided by the router I created), the following query works correctly:


{{{
Book.objects.filter(author__id__gt=x)
}}}

That works as expected since the IDs of author are also present in the Book table, but every other attribute I attempt to access is being fetched from Book's DB instead of Author's DB, which causes broken behavior. For example, this will fetch both objects from the same DB:

{{{
Book.objects.filter(author__first_name='John')
}}}

Is there some kind of workaround to get this to work as it should?
"	Bug	closed	Database layer (models, ORM)	1.3	Normal	invalid	multidb foreignkey	aviv.by@…	Unreviewed	0	0	0	0	0	0
