diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index 576573030..492a2904e 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -105,7 +105,7 @@ def find_recipe_json(ld_json, url): else: ld_json['recipeInstructions'] = '' - ld_json['recipeInstructions'] += _('Imported from ') + url + ld_json['recipeInstructions'] += '\n\n' + _('Imported from ') + url if 'image' in ld_json: # check if list of images is returned, take first if so diff --git a/cookbook/templates/url_import.html b/cookbook/templates/url_import.html index 6a63f2485..e65917028 100644 --- a/cookbook/templates/url_import.html +++ b/cookbook/templates/url_import.html @@ -86,7 +86,7 @@ :options="units" :close-on-select="true" :clear-on-select="true" - :hide-selected="true" + :preserve-search="true" placeholder="{% trans 'Select one' %}" tag-placeholder="{% trans 'Create new' %}" @@ -110,7 +110,7 @@ tag-placeholder="{% trans 'Create new' %}" :close-on-select="true" :clear-on-select="true" - :hide-selected="true" + :preserve-search="true" label="text" :id="index" diff --git a/cookbook/views/data.py b/cookbook/views/data.py index 5a078aae6..a239e7d30 100644 --- a/cookbook/views/data.py +++ b/cookbook/views/data.py @@ -116,7 +116,10 @@ def import_url(request): for ing in data['recipeIngredient']: 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): try: