change set item python

42

new_tags = []
for t in tags:
    existing_tag = self.through.tag_model().objects.get(name__iexact=t)
    if existing_tag:
        new_tags.append(existing_tag)
    else:
        new_tags.append(t)
tags = set(new_tags)

Comments

Submit
0 Comments