-
Notifications
You must be signed in to change notification settings - Fork 2
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
Reduce duplicate queries on instrument list view #143
Reduce duplicate queries on instrument list view #143
Conversation
…t view - Uses existing total instrument count from paginator to get `instrument_num` context variable - Uses custom prefetch manager to filter instrument names by active language on the back-end (simultaneously remove this check from the template rendering) - preselect the related AVResource thumbnail object - extract repeated code to determine "active language" into separate function Also implements minor formatting and typing changes. Refs: DDMAL#141
9720710
to
c34dcf5
Compare
It looks good! @dchiller I only have a few questions:
But when I change the poetry version to the latest version ( Do you think we need to upgrade poetry? Is the error message related to the poetry version?
|
Whoops! You're right, |
I'm seeing the following error in the
I'll take a closer look tomorrow. |
@kunfang98927 The issue with the static files turns out to be here: VIM/web-app/django/VIM/templates/base.html Lines 105 to 108 in 30e5a4f
The parameter to the |
This PR refactors the
InstrumentList
view and associated templates to reduce the number of database queries. See profile:We now select and prefetch related objects, using a custom related objects manager to filter instrument names on the backend, rather than during template rendering (the cause of a great many of the duplicate queries).
The PR also adds some additional python development dependencies to the
pyproject.toml
file:djlint
was configured for html template formatting but had not been added as a dependencydjango
andrequests
packages are added for type checkingCloses #141