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

Fix behavior of ParentalKeys and prefetch_related() supplied with a lookup queryset #130

Merged
merged 2 commits into from
Sep 3, 2020

Conversation

juyrjola
Copy link
Contributor

RelatedManager._apply_rel_filters() must return a copy of the queryset for Django's prefetch_one_level() to work correctly. Otherwise the result cache of the singular Prefetch lookup queryset is overridden and incorrect prefetched results are returned.

I've included a test that should fail if this fix is not in place.

The method must return a copy of the queryset for prefetch_one_level()
to work correctly. Otherwise the result cache of the singular Prefetch
lookup queryset is overridden and incorrect prefetched results
are returned.
@gasman gasman merged commit 75c9dc2 into wagtail:master Sep 3, 2020
@gasman
Copy link
Contributor

gasman commented Sep 3, 2020

Thanks @juyrjola!

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.

2 participants