Skip to content

Commit

Permalink
Merge pull request #79 from Vacasa/bug/issue-77-prevent-patch-double-…
Browse files Browse the repository at this point in the history
…save-preserve-relationships

ISSUE-77 HOTFIX Save the resource after processing relationships
  • Loading branch information
ddobson authored Sep 5, 2019
2 parents 4536c78 + 429c5da commit 7018ee6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drf_jsonapi/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ def partial_update(self, request, *args, **kwargs):
if not serializer.is_valid():
return self.error_response(Error.parse_validation_errors(serializer.errors))

resource = serializer.save()

# Check for relationships and process them
if "relationships" in request.data["data"]:
self.process_relationships(
request.data["data"]["relationships"], resource, request
)

serializer.save()

self.document.instance.data = serializer.data

return Response(self.document.data)
Expand Down

0 comments on commit 7018ee6

Please sign in to comment.