select_related doesn't chain as expected
|Reported by:||Leo Shklovskii||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||jdunck@…, erik.wognsen@…, seldon, Trey Hunner, hrehfeld@…, tomek@…, marc.tamlyn@…, mike@…, i.virabyan@…, real.human@…||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If I'm doing something like:
I would expect the select related to function on both
fieldtwo. What actually happens is that the select_related only works on
fieldtwo. This is a problem for compositing queries at runtime (for example in search filters) and is a departure from how I would expect queryset methods to work.
If the design decision is to keep it this way, there should be a note in the docs pointing this out.
Change History (39)
comment:36 Changed 4 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Accepted → Ready for checkin|