-
Notifications
You must be signed in to change notification settings - Fork 301
Avoid query explosion for related fields where I can user pk_only_opt… #374
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
mblayman
merged 15 commits into
django-json-api:master
from
InvGate:fix-337-query-explosion
Jan 9, 2018
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bc8e8e5
Fix factory boy dependency
b772a15
fix factory-boy version in setup.py and requirements-development.txt
08ce590
Fix setup.py factory boy dependency
bd5acdf
Avoid query explosion for related fields where I can user pk_only_opt…
89ba1d7
Fix autoPrefetchMixin for ReverseOneToOneDescriptor
f2511a3
Merge branch 'fix_factory_boy_bug' into fix-337-query-explosion
ede297e
Fix code style
b2df841
Avoid query objects in ModelSerializer to_representation method
c568086
Merge develop
1fd0040
Fix code queality error
45ea41a
Fix problem that makes None related objects not being renderer
4c2ee9c
Fix problem that makes None related objects not being renderer
3b108b4
_readable_field property is missing in drf<3.2
fa1ffad
Merge branch 'develop' into fix-337-query-explosion
santiavenda2 08d652d
Merge branch 'master' into fix-337-query-explosion
santiavenda2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ Sphinx | |
sphinx_rtd_theme | ||
tox | ||
django-debug-toolbar | ||
packaging==16.8 | ||
packaging==16.8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why this is overriding
to_representation
from theModelSerializer
? It seems like DJA is likely to diverge from the DRF upstream if this method is added. Is there some extra stuff added here that you could call out?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mblayman this is returning the JSON API identifier of the object without diving down the recursive rabbit whole. It looks like an elegant solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the second look, @aidanlister. I took a look at the DRF implementation and the method seems small enough that it would be hard for DJA to diverge too much from upstream.