tags from folders: case insensitive

This commit is contained in:
jonaswinkler 2020-12-09 00:07:22 +01:00
parent 74a99cf330
commit 0a0d462938
2 changed files with 4 additions and 2 deletions

View File

@ -29,7 +29,9 @@ def _tags_from_path(filepath):
path_parts = Path(filepath).relative_to(
settings.CONSUMPTION_DIR).parent.parts
for part in path_parts:
tag_ids.add(Tag.objects.get_or_create(name=part)[0].pk)
tag_ids.add(Tag.objects.get_or_create(name__iexact=part, defaults={
"name": part
})[0].pk)
return tag_ids

View File

@ -230,7 +230,7 @@ class TestConsumerTags(DirectoriesMixin, ConsumerMixin, TransactionTestCase):
tag_names = ("existingTag", "Space Tag")
# Create a Tag prior to consuming a file using it in path
tag_ids = [Tag.objects.create(name=tag_names[0]).pk,]
tag_ids = [Tag.objects.create(name="existingtag").pk,]
self.t_start()