Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use get_list_select_related (fix #1493) #1511

Merged
merged 1 commit into from Nov 7, 2022

Conversation

mpasternak
Copy link
Contributor

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 getting list_select_related, which is called get_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 in get_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.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 5f01347 on mpasternak:main into 2255245 on django-import-export:main.

@matthewhegarty
Copy link
Contributor

thank you 👍

@matthewhegarty matthewhegarty merged commit 9058392 into django-import-export:main Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants