I’m altering django-taggit so that it is not case sensitive.
I want to take the list of tags for an item, check if a different case of them exists, and if so, replace the found tag with the alternative case of the tag.
for t in tags:
existing_tag = self.through.tag_model().objects.get(name__iexact=t)
if existing_tag:
#Replace t in tags with existing_tag
How do I write this last line? I need to replace the typed version of the tag in the set “tags” with the preexisting case of the tag. How do I replace an item in a set?
Don’t modify
tags, create a new version.