mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-08 23:58:15 -05:00
Import recipe keywords
This commit is contained in:
@@ -9,7 +9,7 @@ from django.utils.translation import gettext as _
|
|||||||
|
|
||||||
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
|
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
|
||||||
from cookbook.integration.integration import Integration
|
from cookbook.integration.integration import Integration
|
||||||
from cookbook.models import Recipe, Step, Food, Unit, Ingredient
|
from cookbook.models import Recipe, Step, Food, Unit, Ingredient, Keyword
|
||||||
|
|
||||||
|
|
||||||
class RecetteTek(Integration):
|
class RecetteTek(Integration):
|
||||||
@@ -95,6 +95,16 @@ class RecetteTek(Integration):
|
|||||||
|
|
||||||
recipe.save()
|
recipe.save()
|
||||||
|
|
||||||
|
# Import the recipe keywords
|
||||||
|
try:
|
||||||
|
if file['keywords'] != '':
|
||||||
|
for keyword in file['keywords'].split(';'):
|
||||||
|
k, created = Keyword.objects.get_or_create(name=keyword.strip(), space=self.request.space)
|
||||||
|
recipe.keywords.add(k)
|
||||||
|
recipe.save()
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
# TODO: Parse Nutritional Information
|
# TODO: Parse Nutritional Information
|
||||||
|
|
||||||
# Import the original image from the zip file, if we cannot do that, attempt to download it again.
|
# Import the original image from the zip file, if we cannot do that, attempt to download it again.
|
||||||
|
|||||||
Reference in New Issue
Block a user