pandora_amp/views.py

17 lines
545 B
Python
Raw Normal View History

2018-11-05 19:45:42 +00:00
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from oxdjango.decorators import login_required_json
2018-11-05 20:27:03 +00:00
from oxdjango.shortcuts import render_to_json_response, json_response
2018-11-05 19:45:42 +00:00
from oxdjango.api import actions
from .tasks import import_documents
@login_required_json
def importDocuments(request, data):
2018-11-05 20:27:03 +00:00
response = json_response({})
t = import_documents.delay(urls=data['urls'])
2018-11-05 19:45:42 +00:00
response['data']['taskId'] = t.task_id
return render_to_json_response(response)
actions.register(importDocuments)