Skip to content

Test support of DRF HyperlinkedIdentityField #497

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 4 commits into from
Nov 12, 2018

Conversation

Alig1493
Copy link
Contributor

@Alig1493 Alig1493 commented Oct 16, 2018

Fixes #298

Description of the Change

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • changelog entry added to CHANGELOG.md
  • author name in AUTHORS

@Alig1493
Copy link
Contributor Author

@sliverc I added a test for blog HyperlinkedIdentityField relationship with Entry. It seems the error arises when we we use a non model field to serialize the relationship. If we use a model field name directly then no related links are produced for the blogs and we just a simple blog data without related links.

I can try and look deeper into the issue, not sure if I'll be able to solve it. Will you be able to at least tell me where I might start looking to try and debug this case?

@sliverc
Copy link
Member

sliverc commented Oct 23, 2018

It seems that HyperlinkedIdentityField doesn't support source attribute to be overwritten.

That's why an exception is raised. This should not concern us though as it is not correctly used. So best adjust your test case that we focus on simply using HyperlinkedIdentityField and see that it renders correctly.

@Alig1493 Alig1493 force-pushed the drf-hyperlinkfield-test branch from aa7e0a6 to 183c9b6 Compare October 27, 2018 09:33
@Alig1493
Copy link
Contributor Author

@sliverc I rewrote the tests using default drf serializers to see if the entry works with hyperlinkedrelated field. No issue so far.

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.

A few small changes and this will be ready for merging.

@Alig1493
Copy link
Contributor Author

@sliverc Made requested changes

@sliverc sliverc changed the title default DRF HyperLinkedIdentity Relationship fails for related fields. Test support of DRF HyperlinkedIdentityField Nov 12, 2018
@sliverc sliverc merged commit 7ec8e42 into django-json-api:master Nov 12, 2018
@sliverc
Copy link
Member

sliverc commented Nov 12, 2018

@Alig1493 Thanks.

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