ChangeList.get_queryset() automatically applies select_related() in a very "brute" way
|Reported by:||Béres Botond||Owned by:||Tomek Paczkowski|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If there is a single related field from the listing model in
ChangeList.get_queryset will apply
select_related() so it will join everything, with no depth or field limitations.
Combined with the fact that there's no documented way to clear that (#16856), it's quite undesirable behaviour.
In my opinion this could be resolved in 2 ways:
- Remove that .select_related() call altogether and let the developer choose the exact optimization if he is displaying related fields in the listing
- Optimize the select_related() call so that it's constructed exactly based on which fields appear in
Change History (6)
comment:4 Changed 4 years ago by
|Owner:||changed from Béres Botond to Tomek Paczkowski|
|Status:||new → assigned|