Ejemplo n.º 1
0
def begin_export(request, instance, model):
    query = request.GET.get('q', None)

    job = ExportJob(instance=instance)

    if request.user.is_authenticated():
        job.user = request.user
    job.save()

    async_csv_export.delay(job.pk, model, query)

    return {'start_status': 'OK', 'job_id': job.pk}
Ejemplo n.º 2
0
def begin_export(request, instance, model):
    query = request.GET.get('q', None)
    display_filters = request.GET.get('show', None)

    job = ExportJob(instance=instance,
                    description='csv export of %s' % model)

    if request.user.is_authenticated():
        job.user = request.user
    job.save()

    async_csv_export.delay(job.pk, model, query, display_filters)

    return {'start_status': 'OK', 'job_id': job.pk}
Ejemplo n.º 3
0
def begin_export(request, instance, model):
    if not instance.feature_enabled('exports'):
        return EXPORTS_FEATURE_DISABLED_CONTEXT
    elif not export_enabled_for(instance, request.user):
        return EXPORTS_NOT_ENABLED_CONTEXT

    query = request.GET.get('q', None)
    display_filters = request.GET.get('show', None)

    job = ExportJob(instance=instance,
                    description='csv export of %s' % model)

    if request.user.is_authenticated():
        job.user = request.user
    job.save()

    async_csv_export.delay(job.pk, model, query, display_filters)

    return {'start_status': 'OK', 'job_id': job.pk}