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

Properly resolve relation type with nested source #1065

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
sliverc merged 3 commits into django-json-api:main from bashlyss:many-related-field-source
Jul 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Support many related field
  • Loading branch information
bashlyss authored and sliverc committed Jul 13, 2022
commit 95143814f4ad1af7d83e3d0f85305a8663faa1db
6 changes: 6 additions & 0 deletions rest_framework_json_api/utils.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ def get_related_resource_type(relation):
# For ManyToMany relationships, get the model from the child
# serializer of the list serializer
relation_model = relation.child.Meta.model
elif (
hasattr(relation, "child_relation")
and hasattr(relation.child_relation, "model")
):
# For ManyRelatedField relationships, get the model from the child relationship
relation_model = relation.child_relation.model
else:
parent_serializer = relation.parent
parent_model = None
Expand Down

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