-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
fix: OneToManyInput saves and runs validation on foreign key #487 #490
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Type: Bug fix
PR Summary: This pull request addresses a specific issue with the handling of foreign key relationships in mutations, specifically aiming to optimize the process and reduce the number of database queries required for 'patch' updates. It introduces logic to handle cases where a foreign object is not found by creating it and skips updates when the foreign object does not need updating. Additionally, it optimizes the handling of many-to-many relationships during updates. The PR also includes a test to verify the reduction of database queries for a 'patch' update scenario.
Decision: Comment
📝 Type: 'Bug fix' - not supported yet.
- Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
✅ Small diff: the diff is small enough to approve with confidence.
No details provided.
General suggestions:
- While the changes effectively address the issue described, it's important to ensure that the use of
_default_manager.create()
does not unintentionally bypass any custom managers that might be defined on related models. Consider either supporting custom managers explicitly or documenting the behavior to make the implementation choice clear to future contributors and users.
Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #490 +/- ##
==========================================
+ Coverage 87.91% 87.92% +0.01%
==========================================
Files 37 37
Lines 3170 3173 +3
==========================================
+ Hits 2787 2790 +3
Misses 383 383 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
Thank you for this. I think you just need to fix the pre-commit issues from https://results.pre-commit.ci/run/github/308695886/1709063395.7XoMjDiQR8aEsM7A8X8lnQ
@bellini666 - Good call. Updated. |
Description
Fix for issue described in #487
Notes:
test_relation.py
was blank so deleted it.test_relationship
to clarify my understandingTypes of Changes
Issues Fixed or Closed by This PR
Checklist