-
Notifications
You must be signed in to change notification settings - Fork 301
How to add links (self, related) to model and its relationships? #132
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
Comments
ResourceRelatedField and RelationshipView are your friends - for the latter, see https://github.com/django-json-api/django-rest-framework-json-api/blob/develop/example/urls_test.py#L25 for information on how to implement it. For related links, you will obviously need to setup your own views before referencing them in your ResourceRelatedFields |
Thank you,
The main problem was in my understanding of self and related links for relationships. I wanted for model "user" and relationship "list":
instead of /users/user_id/relationships/lists. But it's so right in jsonapi specification and my shape is valid only for included objects |
Glad I could help 👍 - If you'd like to contribute to the documentation with your findings it'd be awesome :) |
Lets keep that open to remind us to document this :) |
ok, sorry. |
Fixed by #194 |
I figured only self links to main model by adding 'url' to fields in serializer.
How to add "related" link to it? And how to add all links to model relationships?
Thanks
The text was updated successfully, but these errors were encountered: