consolidated integration imports into url_import

This commit is contained in:
smilerz
2021-03-22 15:13:01 -05:00
parent 4ffc54f720
commit 215eadb4a0
2 changed files with 51 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ import threading
from io import BytesIO
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from django.urls import reverse
from django.utils.translation import gettext as _
@@ -68,9 +68,15 @@ def import_recipe(request):
t.setDaemon(True)
t.start()
return HttpResponseRedirect(reverse('view_import_response', args=[il.pk]))
return JsonResponse({'import_id': [il.pk]})
except NotImplementedError:
messages.add_message(request, messages.ERROR, _('Importing is not implemented for this provider'))
return JsonResponse(
{
'error': True,
'msg': _('Importing is not implemented for this provider')
},
status=400
)
else:
form = ImportForm()