fixed empty units/foods (again)
This commit is contained in:
@ -7,7 +7,7 @@ from zipfile import ZipFile
|
||||
import microdata
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from cookbook.helper.ingredient_parser import parse
|
||||
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
|
||||
from cookbook.helper.recipe_url_import import find_recipe_json
|
||||
from cookbook.integration.integration import Integration
|
||||
from cookbook.models import Recipe, Step, Food, Ingredient, Unit
|
||||
@ -33,8 +33,8 @@ class Paprika(Integration):
|
||||
|
||||
for ingredient in recipe_json['ingredients'].split('\n'):
|
||||
amount, unit, ingredient, note = parse(ingredient)
|
||||
f, created = Food.objects.get_or_create(name=ingredient, space=self.request.space)
|
||||
u, created = Unit.objects.get_or_create(name=unit, space=self.request.space)
|
||||
f = get_food(ingredient, self.request.space)
|
||||
u = get_unit(unit, self.request.space)
|
||||
step.ingredients.add(Ingredient.objects.create(
|
||||
food=f, unit=u, amount=amount, note=note
|
||||
))
|
||||
|
Reference in New Issue
Block a user