diff --git a/cookbook/integration/chowdown.py b/cookbook/integration/chowdown.py index 93f20a8d..b6bc07e2 100644 --- a/cookbook/integration/chowdown.py +++ b/cookbook/integration/chowdown.py @@ -51,6 +51,7 @@ class Chowdown(Integration): recipe = Recipe.objects.create(name=title, created_by=self.request.user, internal=True, space=self.request.space) for k in tags.split(','): + print(f'adding keyword {k.strip()}') keyword, created = Keyword.get_or_create(name=k.strip(), space=self.request.space) recipe.keywords.add(keyword) diff --git a/cookbook/integration/integration.py b/cookbook/integration/integration.py index 8ab33e71..9e23f73e 100644 --- a/cookbook/integration/integration.py +++ b/cookbook/integration/integration.py @@ -140,7 +140,7 @@ class Integration: il.imported_recipes += 1 il.save() except Exception as e: - self.handle_exception(e, log=il, message=f'-------------------- \n ERROR \n{e}\n--------------------\n') + self.handle_exception(e, log=il, message=f'-------------------- \nERROR \n{e}\n--------------------\n') import_zip.close() elif '.json' in f['name'] or '.txt' in f['name']: data_list = self.split_recipe_file(f['file']) @@ -154,7 +154,7 @@ class Integration: il.imported_recipes += 1 il.save() except Exception as e: - self.handle_exception(e, log=il, message=f'-------------------- \n ERROR \n{e}\n--------------------\n') + self.handle_exception(e, log=il, message=f'-------------------- \nERROR \n{e}\n--------------------\n') elif '.rtk' in f['name']: import_zip = ZipFile(f['file']) for z in import_zip.filelist: @@ -171,7 +171,7 @@ class Integration: il.imported_recipes += 1 il.save() except Exception as e: - self.handle_exception(e, log=il, message=f'-------------------- \n ERROR \n{e}\n--------------------\n') + self.handle_exception(e, log=il, message=f'-------------------- \nERROR \n{e}\n--------------------\n') import_zip.close() else: recipe = self.get_recipe_from_file(f['file']) diff --git a/cookbook/serializer.py b/cookbook/serializer.py index a24d7efe..34b40bb0 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -224,7 +224,7 @@ class KeywordSerializer(UniqueFieldsMixin, serializers.ModelSerializer): # since multi select tags dont have id's # duplicate names might be routed to create validated_data['space'] = self.context['request'].space - obj = Keyword.get_or_create(**validated_data) + obj, created = Keyword.get_or_create(**validated_data) return obj class Meta: