simonwillisonblog icon indicating copy to clipboard operation
simonwillisonblog copied to clipboard

Add merge tags tool

Open simonw opened this issue 1 year ago • 1 comments

Add a tool for merging two tags at /admin/merge-tags/.

  • Add a view in blog/staff_views.py for handling the merge tags functionality with the staff_member_required decorator.
  • Add a URL pattern in config/urls.py for /admin/merge-tags/.
  • Create a form in templates/merge_tags.html with 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 PreviousTagName record 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.

simonw avatar Jul 12 '24 16:07 simonw

Direct assignment to the forward side of a many-to-many set is prohibited. Use tags.set() instead.

simonw avatar Jul 12 '24 16:07 simonw