(request)
return HttpResponse(json.dumps(data), content_type="application/json")
Given a list of Mongo objectIDs, parse and import the associated
    content blocks. User can select whether to delete or keep
    unimported blocks from the same poll via the 'action' key. An action
    of "import_delete" directs the parser to delete unimported content
    from the same poll, while any other value for 'action' keeps the
    unimported content. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :returns: :class:`django.http.HttpResponse`
Given a list of Mongo objectIDs, parse and import the associated
    content blocks. User can select whether to delete or keep
    unimported blocks from the same poll via the 'action' key. An action
    of "import_delete" directs the parser to delete unimported content
    from the same poll, while any other value for 'action' keeps the
    unimported content. Should be an AJAX POST.
Given a list of Mongo objectIDs parse and import the associated content blocks . User can select whether to delete or keep unimported blocks from the same poll via the action key . An action of import_delete directs the parser to delete unimported content from the same poll while any other value for action keeps the unimported content . Should be an AJAX POST .
def import_taxii_data(request):
    """
    Given a list of Mongo objectIDs, parse and import the associated
    content blocks. User can select whether to delete or keep
    unimported blocks from the same poll via the 'action' key. An action
    of "import_delete" directs the parser to delete unimported content
    from the same poll, while any other value for 'action' keeps the
    unimported content. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :returns: :class:`django.http.HttpResponse`
    """
    analyst = request.user.username
    post_data = json.loads(request.body)
    poll_id = post_data.get('poll_id')
    action = post_data.get('action')
    result = handlers.import_poll(poll_id, analyst, action)

    data = {'success': result['status'], 'msg': result['msg']}
    data['html'] = render_to_string("taxii_agent_results.html",
                                    {'imported' : result})
    return HttpResponse(json.dumps(data), content_type="application/json")
def import_taxii_data ( request ) : analyst = request . user . username post_data = json . loads ( request . body ) poll_id = post_data . get ( 'poll_id' ) action = post_data . get ( 'action' ) result = handlers . import_poll ( poll_id , analyst , action ) data = { 'success' : result [ 'status' ] , 'msg' : result [ 'msg' ] } data [ 'html' ] = render_to_string ( "taxii_agent_results.html" , { 'imported' : result } ) return HttpResponse ( json . dumps ( data ) , content_type = "application/json" )