Conversation
Introduce `clone()` method for the Cable model to enable cloning its attributes, including termination type and parent selectors. Updates mappings to align with CableForm workflows, supporting "Clone" and "Create & Add Another" actions. Fixes #21429
7172db3 to
951d856
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #21429
This PR fixes the “Create & Add Another” workflow for cables by ensuring the selected termination types are preserved.
To do this, it extends
Cable.clone()to include the form-only fields required byget_cable_form()(termination type and the relevant parent selector fields for each end). This makes both “Clone” and “Create & Add Another” behave consistently, while intentionally not cloning the actual terminations (since those endpoints are already occupied).I’ve added a small note in
get_cable_form()to document thatCable.clone()mirrors its parent selector mapping to help keep these in sync going forward.Thanks for reviewing!