minor fixes keyword tree system
This commit is contained in:
parent
a6e351736b
commit
89ec549dac
@ -51,6 +51,7 @@ class Chowdown(Integration):
|
|||||||
recipe = Recipe.objects.create(name=title, created_by=self.request.user, internal=True, space=self.request.space)
|
recipe = Recipe.objects.create(name=title, created_by=self.request.user, internal=True, space=self.request.space)
|
||||||
|
|
||||||
for k in tags.split(','):
|
for k in tags.split(','):
|
||||||
|
print(f'adding keyword {k.strip()}')
|
||||||
keyword, created = Keyword.get_or_create(name=k.strip(), space=self.request.space)
|
keyword, created = Keyword.get_or_create(name=k.strip(), space=self.request.space)
|
||||||
recipe.keywords.add(keyword)
|
recipe.keywords.add(keyword)
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class Integration:
|
|||||||
il.imported_recipes += 1
|
il.imported_recipes += 1
|
||||||
il.save()
|
il.save()
|
||||||
except Exception as e:
|
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()
|
import_zip.close()
|
||||||
elif '.json' in f['name'] or '.txt' in f['name']:
|
elif '.json' in f['name'] or '.txt' in f['name']:
|
||||||
data_list = self.split_recipe_file(f['file'])
|
data_list = self.split_recipe_file(f['file'])
|
||||||
@ -154,7 +154,7 @@ class Integration:
|
|||||||
il.imported_recipes += 1
|
il.imported_recipes += 1
|
||||||
il.save()
|
il.save()
|
||||||
except Exception as e:
|
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']:
|
elif '.rtk' in f['name']:
|
||||||
import_zip = ZipFile(f['file'])
|
import_zip = ZipFile(f['file'])
|
||||||
for z in import_zip.filelist:
|
for z in import_zip.filelist:
|
||||||
@ -171,7 +171,7 @@ class Integration:
|
|||||||
il.imported_recipes += 1
|
il.imported_recipes += 1
|
||||||
il.save()
|
il.save()
|
||||||
except Exception as e:
|
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()
|
import_zip.close()
|
||||||
else:
|
else:
|
||||||
recipe = self.get_recipe_from_file(f['file'])
|
recipe = self.get_recipe_from_file(f['file'])
|
||||||
|
@ -224,7 +224,7 @@ class KeywordSerializer(UniqueFieldsMixin, serializers.ModelSerializer):
|
|||||||
# since multi select tags dont have id's
|
# since multi select tags dont have id's
|
||||||
# duplicate names might be routed to create
|
# duplicate names might be routed to create
|
||||||
validated_data['space'] = self.context['request'].space
|
validated_data['space'] = self.context['request'].space
|
||||||
obj = Keyword.get_or_create(**validated_data)
|
obj, created = Keyword.get_or_create(**validated_data)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
Loading…
Reference in New Issue
Block a user