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

Prefetching #1842

Merged
merged 8 commits into from
Feb 6, 2023
Merged

Prefetching #1842

merged 8 commits into from
Feb 6, 2023

Conversation

richardebeling
Copy link
Member

@richardebeling richardebeling commented Dec 30, 2022

I went through the pages and fixed some N+1 query patterns we had.

Throughout the commits I changed a bit of stuff with the is_m2m_prefetched method. I ended up just making it is_prefetched and handle both m2m as well as foreign key fields (forward and backward lookup). A given attribute on a model can only refer to a single field type, so it doesn't add much to have separate is_prefetched methods.

evap/grades/views.py Outdated Show resolved Hide resolved
evap/evaluation/models.py Show resolved Hide resolved
evap/evaluation/tests/test_tools.py Outdated Show resolved Hide resolved
evap/evaluation/tests/test_tools.py Outdated Show resolved Hide resolved
evap/evaluation/tests/test_tools.py Show resolved Hide resolved
evap/evaluation/models.py Show resolved Hide resolved
evap/evaluation/models.py Show resolved Hide resolved
@niklasmohrin
Copy link
Member

Looks good, except for the last comment that blocks it

Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :)

@richardebeling richardebeling merged commit 680ced2 into e-valuation:main Feb 6, 2023
@richardebeling richardebeling deleted the prefetching branch February 6, 2023 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants