-
Notifications
You must be signed in to change notification settings - Fork 300
Add support for related links using parent view and its permissions #451
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
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ffe61c6
Pass related field name to "get_url" method
Anton-Shutik 196d8ba
Added RelatedMixin
Anton-Shutik fc52dc4
Inherit ModelViewSet and ReadOnlyModelViewSet from RelatedMixin
Anton-Shutik 73d51a5
Use dotted path when declaring serializers
Anton-Shutik 7677042
Added doc string to HyperlinkedMixin
Anton-Shutik bde21ec
Get field name from serializer class
Anton-Shutik 9e78e67
Use mapping for field name resolving
Anton-Shutik d9b5f08
Improve serializer class resolving
Anton-Shutik 9decc1f
Improved related instance resolving
Anton-Shutik 77ac0b2
Added SerializerMethodResourceRelatedField + RelatedMixin example
Anton-Shutik 6e0b47c
Fix failing tox
Anton-Shutik a210e63
Moved "related_serializers" from view to serializer
Anton-Shutik c148507
Added tests
Anton-Shutik c0f0dab
Added docs
Anton-Shutik 228b1e8
Updated changelog
Anton-Shutik 8191d6d
Added test + small improve
Anton-Shutik b8a902f
Updated imports order, docs/usage.md
Anton-Shutik 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
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
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.
Do you think we should combine this documentation with https://django-rest-framework-json-api.readthedocs.io/en/stable/usage.html#related-fields ?
Maybe we do not need to document overwriting of
get_queryset
anymore as this is obsolete. Or do you still see a use case for it?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.
It is still working and can be used. I think we can remove the docs when we deprecate this stuff.
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.
I have just read through the documentation again and I am not sure whether it is clear why there are two different ways to basically do the same.
I think the one difference is that with the old way overwriting
get_queryset
someone can define different permissions on view which can not so easily be done with theRelatedMixin
.Somehow we should try to merge those two documentation pieces into one, recommending to use
RelatedMixin
way but still documenting old way in case of having different permissions for relations.I first was planning to work on this but I do not really have time at hand. So if you have a suggestion feel free. Otherwise I might get to it at a later point.