recipe import unit/ingredeitn selection

This commit is contained in:
vabene1111
2020-06-23 12:34:00 +02:00
parent 98c278fe60
commit 5ed369ba69
3 changed files with 116 additions and 23 deletions

View File

@@ -115,8 +115,8 @@ def import_url(request):
recipe.keywords.add(k)
for ing in data['recipeIngredient']:
i, i_created = Ingredient.objects.get_or_create(name=ing['ingredient'])
u, u_created = Unit.objects.get_or_create(name=ing['unit'])
i, i_created = Ingredient.objects.get_or_create(name=ing['ingredient']['text'])
u, u_created = Unit.objects.get_or_create(name=ing['unit']['text'])
if isinstance(ing['amount'], str):
try: