Skip to content

Use PreloadIncludesMixin for ReadOnlyModelViewSet #946

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

Merged
merged 2 commits into from
May 28, 2021

Conversation

anehx
Copy link
Contributor

@anehx anehx commented May 25, 2021

Description of the Change

This allows the usage of select_for_includes and prefetch_for_includes on ReadOnlyModelViewSet

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added updated
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

@codecov
Copy link

codecov bot commented May 25, 2021

Codecov Report

Merging #946 (65d41f7) into master (2eea772) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #946      +/-   ##
==========================================
+ Coverage   97.69%   97.70%   +0.01%     
==========================================
  Files          58       59       +1     
  Lines        3120     3134      +14     
==========================================
+ Hits         3048     3062      +14     
  Misses         72       72              
Impacted Files Coverage Δ
example/migrations/0009_labresults_author.py 100.00% <100.00%> (ø)
example/tests/test_performance.py 100.00% <100.00%> (ø)
example/urls_test.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2eea772...65d41f7. Read the comment docs.

@sliverc sliverc self-requested a review May 25, 2021 17:13
Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

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

hi @anehx it has been a while since I reviewed one of your PRs 😄

Nice catch with this fix. Thanks. It seems that is a regression of PR #600 so since version 2.8.0. I have added checklist into your PR description to see what is missing.

As this is a regression it is actually important to add a test so this is not happening again.

Have a look at #600 where there is a test example which I guess can be done on a ReadOnlyViewSet as well. Also add yourself to AUTHORS if not done yet and add a changelog entry. Thanks.

This allows the usage of `select_for_includes` and `prefetch_for_includes` on `ReadOnlyModelViewSet`
@anehx anehx requested a review from sliverc May 26, 2021 08:45
Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

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

Thanks a lot. LGTM.

@sliverc sliverc changed the title fix(perf): use preload includes mixin for read only model view set Use PreloadIncludesMixin for ReadOnlyModelViewSet May 28, 2021
@sliverc sliverc merged commit 858119e into django-json-api:master May 28, 2021
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