mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -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.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):
|
||||
@@ -95,6 +95,16 @@ class RecetteTek(Integration):
|
||||
|
||||
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
|
||||
|
||||
# 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