Hi,
Some question about the current behavior in the ManyRelatedManager in
django.db.models.fields.related.
This manager has a method get_query_set. Why is it that the model name
of the field where the foreign key is defined in, is passed to the
database router? I think it's more logical to pass the model where the
foreign key points to instead.
Suppose we have a Model1 and Model2. And Model1 defines a foreign key
to Model2. We have an instance model1. So, the property
model1.model2_id exists. Now we retreive the model2 object by doing:
"model1.model2". This will cause a query Model2.objects.get(id=...) to
be executed. Model1 is defenitely not involved, so I think there's no
reasen to pass Model1 to the router, instead of Model2.
This patch should solve it:
http://paste.pocoo.org/show/343888/
cheers,
Jonathan