(request, pk, task_id)
return HttpResponse(
        json.dumps({
            'state': res.state,
            'link': link,
            'email': getattr(
                settings,
                'REPORT_BUILDER_EMAIL_NOTIFICATION',
                False
            )
        }),
        content_type="application/json")
Check if the asyncronous report is ready to download
Check if the asyncronous report is ready to download
Check if the asyncronous report is ready to download
def check_status(request, pk, task_id):
    """ Check if the asyncronous report is ready to download """
    from celery.result import AsyncResult
    res = AsyncResult(task_id)
    link = ''
    if res.state == 'SUCCESS':
        report = get_object_or_404(Report, pk=pk)
        link = report.report_file.url
    return HttpResponse(
        json.dumps({
            'state': res.state,
            'link': link,
            'email': getattr(
                settings,
                'REPORT_BUILDER_EMAIL_NOTIFICATION',
                False
            )
        }),
        content_type="application/json")
def check_status ( request , pk , task_id ) : from celery . result import AsyncResult res = AsyncResult ( task_id ) link = '' if res . state == 'SUCCESS' : report = get_object_or_404 ( Report , pk = pk ) link = report . report_file . url return HttpResponse ( json . dumps ( { 'state' : res . state , 'link' : link , 'email' : getattr ( settings , 'REPORT_BUILDER_EMAIL_NOTIFICATION' , False ) } ) , content_type = "application/json" )