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

Clear m2m relationships instead of deleting related objects during PATCH #788

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

Conversation

Copy link
Contributor

@rohithpr rohithpr commented May 14, 2020
edited by sliverc
Loading

Description of the Change

Calling PATCH on an M2M RelationshipView when there were already some relationships was breaking. This was because the related objects were being deleted instead of just clearing the relationship and starting afresh.

Fixes #784
Fixes #244

Manual testing proof:
image

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

@rohithpr rohithpr force-pushed the fix-784-relationship-view-patch-endpoint branch from 6deae03 to 25a36fa Compare May 14, 2020 13:03
Copy link

codecov bot commented May 14, 2020
edited
Loading

Codecov Report

Merging #788 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@
## master #788 +/- ##
=======================================
 Coverage 97.39% 97.39% 
=======================================
 Files 56 56 
 Lines 2989 2999 +10 
=======================================
+ Hits 2911 2921 +10 
 Misses 78 78 
Impacted Files Coverage Δ
example/tests/test_views.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f87eeaf...3b6c12d. Read the comment docs.

@rohithpr rohithpr changed the title (削除) Fix #784 Clear m2m relationships instead of deleting them during PATCH (削除ここまで) (追記) Fix #784 Clear m2m relationships instead of deleting related objects during PATCH (追記ここまで) May 14, 2020
@rohithpr rohithpr marked this pull request as ready for review May 14, 2020 13:23
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.

Thanks for working on this. I think the patch method needs some refactoring. See my comment above and feel free to discuss it as you think it is best.

@rohithpr rohithpr force-pushed the fix-784-relationship-view-patch-endpoint branch 2 times, most recently from 26ca39a to 6021bd3 Compare June 10, 2020 06:27
@sliverc sliverc changed the title (削除) Fix #784 Clear m2m relationships instead of deleting related objects during PATCH (削除ここまで) (追記) Clear m2m relationships instead of deleting related objects during PATCH (追記ここまで) Jun 13, 2020
rohithpr and others added 7 commits June 13, 2020 14:34
@sliverc sliverc force-pushed the fix-784-relationship-view-patch-endpoint branch from b5ecca9 to 3b6c12d Compare June 13, 2020 12:41
Copy link
Member

sliverc commented Jun 13, 2020

Thanks for your work! I have only added another test to make sure that #244 now works as well.

rohithpr reacted with thumbs up emoji

@sliverc sliverc merged commit 6e5d995 into django-json-api:master Jun 13, 2020
@rohithpr rohithpr deleted the fix-784-relationship-view-patch-endpoint branch June 22, 2020 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@sliverc sliverc sliverc approved these changes

+1 more reviewer

@auvipy auvipy auvipy approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Issues with RelationshipView PATCH endpoint (to-many) Removing relationship through empty PATCH request

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