diff --git a/taggit/managers.py b/taggit/managers.py index 6e2dac15..023bf876 100644 --- a/taggit/managers.py +++ b/taggit/managers.py @@ -225,6 +225,10 @@ def _to_tag_model_instances(self, tags, tag_kwargs): # tags can be instances of our through models, or strings tag_strs = [tag for tag in tags if isinstance(tag, str)] + # This map from tag names to tags lets us handle deduplication + # without doing extra queries along the way, all while relying on + # data we were going to pull out of the database anyways + # existing_tags_for_str[tag_name] = tag existing_tags_for_str = {} # we are going to first try and lookup existing tags (in a single query) if case_insensitive: