simonwillisonblog
simonwillisonblog copied to clipboard
Add merge tags tool
Add a tool for merging two tags at /admin/merge-tags/.
- Add a view in
blog/staff_views.pyfor handling the merge tags functionality with thestaff_member_requireddecorator. - Add a URL pattern in
config/urls.pyfor/admin/merge-tags/. - Create a form in
templates/merge_tags.htmlwith two input boxes for selecting tags using the/tags-autocomplete/JSON endpoint. - On POST, update quotations, entries, and blogmarks tagged with the loser tag, remove the loser tag, and add the winner tag.
- Delete the loser tag and create a
PreviousTagNamerecord pointing to the winner tag. - Add unit tests for the merge tags feature in
blog/tests.py.
For more details, open the Copilot Workspace session.
Direct assignment to the forward side of a many-to-many set is prohibited. Use tags.set() instead.