Skip to content

Commit

Permalink
Merge pull request #6157 from akatsoulas/delete-existing-redirect
Browse files Browse the repository at this point in the history
Delete existing redirects if slug exists in taxonomy.
  • Loading branch information
escattone authored Jul 31, 2024
2 parents 1cc64b7 + db8dd6e commit 219caad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kitsune/products/migrations/0015_auto_20240722_0449.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,11 @@ def migrate_topics(apps, schema_editor):
slug=entry["old_slug"], defaults={"topic": new_topic}
)
if not created:
topic_slug.topic = new_topic
topic_slug.save()
if topic_slug.slug == new_topic.slug:
topic_slug.delete()
else:
topic_slug.topic = new_topic
topic_slug.save()

# Archive the old topic
old_topic.is_archived = True
Expand Down

0 comments on commit 219caad

Please sign in to comment.