bug fix url import

This commit is contained in:
smilerz
2021-04-05 21:41:00 -05:00
parent c50bd039ef
commit 4bc4ce0d7c
6 changed files with 63 additions and 117 deletions

View File

@@ -614,31 +614,6 @@ def get_plan_ical(request, from_date, to_date):
return response
@group_required('user')
def recipe_from_json(request):
mjson = request.POST['json']
md_json = json.loads(mjson)
for ld_json_item in md_json:
# recipes type might be wrapped in @graph type
if '@graph' in ld_json_item:
for x in md_json['@graph']:
if '@type' in x and x['@type'] == 'Recipe':
md_json = x
if ('@type' in md_json
and md_json['@type'] == 'Recipe'):
return JsonResponse(find_recipe_json(md_json, '', request.space))
return JsonResponse(
{
'error': True,
'msg': _('Could not parse correctly...')
},
status=400
)
@group_required('user')
def recipe_from_source(request):
url = request.POST.get('url', None)