Use get_list_select_related (fix #1493) #1511
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
To be honest, this is not exactly a problem, as long as you don't heavily modify Django admin and write classes inheriting from
ExportMixin
. Since some time Django has a special utility function for gettinglist_select_related
, which is calledget_list_select_related
and it should be used to override some settings.In my application I used it to implement dynamic Django admin columns (https://github.com/iplweb/bpp/blob/dev/src/dynamic_columns/mixins.py#L8) and it occurred, that
ExportMixin
(that I also use, that's a quite big project) doesn't play nicely with it, so well, here I am.Solution
All this needs is to analogically call to
get_*
, just like we already do inget_list_display
and such.Acceptance Criteria
No additional tests, Django 3.2 and 4.0 pass.
Screenshots of my changes... are identical to the changes.
I documented the changes in the changelog.rst and added myself to the deep bottom of
AUTHORS
.