-
Notifications
You must be signed in to change notification settings - Fork 299
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
SerializerMethodResourceRelatedField with many=True does not show up in included #260
Conversation
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
khornberg
commented
Aug 18, 2016
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.
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.
I would view this as a bug: when a field is specified in include
it should be included.
...ub.com/tbartelmess/django-rest-framework-json-api into tbartelmess-fix/include-in-many-related-serializer Closes #260
khornberg
commented
Aug 18, 2016
Yeah, after playing with it, I came to the same conclusion.
When using a
SerializerMethodResourceRelatedField
in a serializer, withmany=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).