Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Prefetch default included resources#900

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sliverc merged 6 commits intodjango-json-api:masterfromSafaAlfulaij:fix-included-serializers
May 2, 2021
Merged

Prefetch default included resources#900

sliverc merged 6 commits intodjango-json-api:masterfromSafaAlfulaij:fix-included-serializers
May 2, 2021

Conversation

SafaAlfulaij
Copy link
Contributor

@SafaAlfulaijSafaAlfulaij commentedMar 28, 2021
edited by sliverc
Loading

Description of the Change

Pass the serializer toselect_related andprefetch_related defaultincluded_resources. Without this, only resources specified by?include are used.

Checklist

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

@SafaAlfulaij
Copy link
ContributorAuthor

Sorry, but I have no idea why the test is failing.
I've never done tests.

@sliverc
Copy link
Member

Thanks for your contribution. PR number 900... wow! This is certainly a good addition to add support for default included resources. We might even consider this to be a bug that this has not been the case in the first place...

In terms of tests for quality assurance all PRs in DJA need to have a test to prove that the change actually does what it is supposed too.

It is never too late to start learning about testing though... for instance this is agood tutorial but there are many others out there.

It also seems with your change you discovered a potential another problem that inlcudes currently do not work when using relationship view. Seefailing test where a relationship view now prefetches default resources and fails.

Some more research needs to be done. If you think this is a bit too hard of a task we can also convert this PR to a issue report and somewhere else can have a look at it and have your PR as a reference.

Do you wanna give it or shot or shall we convert it to a bug report? What do you think?

@SafaAlfulaij
Copy link
ContributorAuthor

I'm not sure if the test environment is different than the normal environment, but/entries?fields[entry]=comments&page[size]=25 executes exactly 3 queries. I don't know why the test environment ignoresfields[entry]=comments.

Anyway, this is the best I can reach in testing. If anyone is willing to do more, please feel free to take over.

@SafaAlfulaij
Copy link
ContributorAuthor

So the tests use the plural (normal I believe) form of resources, while the end-user example uses the singular form.
Should be fixed now.

@codecov
Copy link

codecovbot commentedApr 3, 2021
edited
Loading

Codecov Report

Merging#900 (74d2a17) intomaster (a5df955) willincrease coverage by0.00%.
The diff coverage is100.00%.

Impacted file tree graph

@@           Coverage Diff           @@##           master     #900   +/-   ##=======================================  Coverage   97.68%   97.69%           =======================================  Files          58       58             Lines        3115     3120    +5     =======================================+ Hits         3043     3048    +5  Misses         72       72
Impacted FilesCoverage Δ
example/tests/test_performance.py100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatea5df955...74d2a17. Read thecomment docs.

@sliverc
Copy link
Member

@SafaAlfulaij As of changes merged in#914 could you rebase this to master?

@simkimsia
Copy link

It seems that this is the only issue preventing#911. I can free up sometime this coming Wednesday to look at rebasing this to master if that helps?

@sliverc
Copy link
Member

@simkimsia Thanks for your offer. Really appreciated. I got around today to look at this PR and hope a new version of DJA will be out soon.

simkimsia reacted with thumbs up emoji

Copy link
Member

@slivercsliverc left a comment

Choose a reason for hiding this comment

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

@SafaAlfulaij I made some small adjustment and the PR is now ready for merging. Thanks for your work!

SafaAlfulaij reacted with thumbs up emoji
@slivercsliverc changed the titlePrefetch default resourcesPrefetch default included resourcesMay 2, 2021
@slivercsliverc merged commitfbb4b03 intodjango-json-api:masterMay 2, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@slivercslivercsliverc approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@SafaAlfulaij@sliverc@simkimsia

[8]ページ先頭

©2009-2025 Movatter.jp