Add fork functionality for code snippets #651
Open
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.
This PR adds fork functionality to code snippets, allowing users to create their own versions of existing snippets (similar to GitHub's fork feature for repositories). This enhances collaboration by enabling users to build upon shared code.
Changes Made
cab/models.py): Addedforked_fromfield andfork()method to theSnippetmodel.cab/views/snippets.py): Addedfork_snippetview for handling fork requests.cab/urls/snippets.py): Added route for/snippets/<id>/fork/.djangosnippets/templates/cab/snippet_detail.html): Added fork button and "Forked from" display.cab/migrations/0007_add_forked_from.py): Added migration for the new field.cab/tests/tests.py): Addedtest_snippet_forkto verify functionality.How It Works
forked_from.Benefits
Closes #< issue 650>