fixed import error
This commit is contained in:
@ -105,7 +105,7 @@ def find_recipe_json(ld_json, url):
|
|||||||
else:
|
else:
|
||||||
ld_json['recipeInstructions'] = ''
|
ld_json['recipeInstructions'] = ''
|
||||||
|
|
||||||
ld_json['recipeInstructions'] += _('Imported from ') + url
|
ld_json['recipeInstructions'] += '\n\n' + _('Imported from ') + url
|
||||||
|
|
||||||
if 'image' in ld_json:
|
if 'image' in ld_json:
|
||||||
# check if list of images is returned, take first if so
|
# check if list of images is returned, take first if so
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
:options="units"
|
:options="units"
|
||||||
:close-on-select="true"
|
:close-on-select="true"
|
||||||
:clear-on-select="true"
|
:clear-on-select="true"
|
||||||
:hide-selected="true"
|
|
||||||
:preserve-search="true"
|
:preserve-search="true"
|
||||||
placeholder="{% trans 'Select one' %}"
|
placeholder="{% trans 'Select one' %}"
|
||||||
tag-placeholder="{% trans 'Create new' %}"
|
tag-placeholder="{% trans 'Create new' %}"
|
||||||
@ -110,7 +110,7 @@
|
|||||||
tag-placeholder="{% trans 'Create new' %}"
|
tag-placeholder="{% trans 'Create new' %}"
|
||||||
:close-on-select="true"
|
:close-on-select="true"
|
||||||
:clear-on-select="true"
|
:clear-on-select="true"
|
||||||
:hide-selected="true"
|
|
||||||
:preserve-search="true"
|
:preserve-search="true"
|
||||||
label="text"
|
label="text"
|
||||||
:id="index"
|
:id="index"
|
||||||
|
@ -116,7 +116,10 @@ def import_url(request):
|
|||||||
|
|
||||||
for ing in data['recipeIngredient']:
|
for ing in data['recipeIngredient']:
|
||||||
i, i_created = Ingredient.objects.get_or_create(name=ing['ingredient']['text'])
|
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 ing['unit']:
|
||||||
|
u, u_created = Unit.objects.get_or_create(name=ing['unit']['text'])
|
||||||
|
else:
|
||||||
|
u = Unit.objects.get(name=request.user.userpreference.default_unit)
|
||||||
|
|
||||||
if isinstance(ing['amount'], str):
|
if isinstance(ing['amount'], str):
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user