-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Keep reference of copied items for cross referencing #579
Conversation
@jackton1 Closed the other in favor of this. I fixed the linting errors and added another assert in the test. Ready for review IMO. |
Ok. Nvm there is an issue with the o2o cloning. Will fix and test |
Ok the issue only appears if I make |
Ok fixed and now also closes #544 |
Hello @saschahofmann! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2022-04-07 13:52:08 UTC |
Codecov Report
@@ Coverage Diff @@
## main #579 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 285 297 +12
=========================================
+ Hits 285 297 +12
Continue to review full report at Codecov.
|
@saschahofmann Can you also resolve these errors. |
Done |
Two suggestions:
|
Seems we need to improve the test coverage it’s currently under 100% |
Yeah exactly and it's super annoying to find which lines are covered because half the file is flagged by codescanner |
@jackton1 I actually discovered a few problems with cross-references. I think it boils down to this: Example: class Sentence(CloneMixin, models.Model):
value = models.TextField()
_clone_o2o_fields = {"ending",}
class Ending(CloneMixin, models.Model):
sentence = models.OneToOneField(
Sentence, on_delete=models.CASCADE, related_name="ending"
)
_clone_o2o_fields = {"sentence"}
class Triangle(CloneMixin, models.Model):
sentence = models.OneToOneField(
Sentence, on_delete=models.CASCADE, related_name="triangle"
)
ending = models.OneToOneField(
Ending, on_delete=models.CASCADE, related_name="triangle"
)
_clone_o2o_fields = {"sentence", "ending"} This is a triangular relationship When it copies |
@saschahofmann See: #669 |
As explained in #544, I am trying to keep track of instances that have been cloned before and reuse that copy for later references that otherwise would be cloned again.
I added on example test, are you ok with me adding cross-references between the tables or should I create new models and do you prefer one big test for all cases or individual ones?