keyword update, tests sqlite and PG

This commit is contained in:
smilerz
2021-07-30 14:00:09 -05:00
parent 2f91c2f86e
commit 2da0f5c478
26 changed files with 245 additions and 277 deletions

View File

@ -148,14 +148,9 @@ def import_url(request):
recipe.steps.add(step)
all_keywords = Keyword.get_tree()
for kw in data['keywords']:
q = all_keywords.filter(name=kw['text'], space=request.space)
if len(q) != 0:
recipe.keywords.add(q[0])
elif data['all_keywords']:
k = Keyword.add_root(name=kw['text'], space=request.space)
recipe.keywords.add(k)
k = Keyword.objects.get_or_create(name=kw['text'], space=request.space)
recipe.keywords.add(k)
for ing in data['recipeIngredient']:
ingredient = Ingredient(space=request.space,)