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

SerializerMethodResourceRelatedField with many=True does not show up in included #260

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
jerel merged 2 commits into django-json-api:develop from tbartelmess:fix/include-in-many-related-serializer
Aug 18, 2016
Merged

SerializerMethodResourceRelatedField with many=True does not show up in included #260

jerel merged 2 commits into django-json-api:develop from tbartelmess:fix/include-in-many-related-serializer
Aug 18, 2016

Conversation

Copy link
Contributor

@tbartelmess tbartelmess commented Jul 19, 2016

When using a SerializerMethodResourceRelatedField in a serializer, with many=True being set, and the request is asking for to include it (via the ?include) parameter, the field is not included in the result.

This PR adds a test and a fairly hackish fix (by checking is a 'child_relation' is present in the _kwargs parameter, when the field is evaluated for includes).

khornberg reacted with thumbs up emoji
Copy link
Contributor Author

It looks like only one building Travis failed. It looks like the setup failed
The command "curl -s -o python-3.5.tar.bz2 ${archive_url}" failed and exited with 18 during .
not an actual test

Copy link

Would it be helpful if this was behind a setting so that those with accustomed to the current behavior are not affected? Or is this a bug? I am preferable to the former.

khornberg added a commit to imtapps-dev/django-rest-framework-json-api that referenced this pull request Aug 18, 2016
Adds PR 260
django-json-api#260
This allows a resource related field to be returned with the request
instead of having to make multiple requests to get related fields.
@jerel jerel added this to the 2.1.0 milestone Aug 18, 2016
Copy link
Member

jerel commented Aug 18, 2016

I would view this as a bug: when a field is specified in include it should be included.

jerel added a commit that referenced this pull request Aug 18, 2016
Copy link

Yeah, after playing with it, I came to the same conclusion.

@jerel jerel merged commit c1049e4 into django-json-api:develop Aug 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
2.1.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /