@staff_member_required
def export_options(request, task_id, exporter_index):
    try:
        task = Task.objects.get(pk=task_id)
    except Task.DoesNotExist:
        raise Http404('Task does not exist')
    available_exporters = find_all_exporters(task.type)
    exporter = available_exporters[int(exporter_index)]()
    exporter.task = task
    if (request.method == 'POST'):
        form = exporter.get_form(data=request.POST)
        if form.is_valid():
            (success, message) = exporter.export(form)
            if success:
                messages.success(request, ('Export finished: ' + message))
            else:
                messages.error(request, ('Export failed: ' + message))
            return redirect('index')
    else:
        form = exporter.get_form()
    return render(request, 'annotationweb/export_options.html', {'form': form, 'exporter_index': exporter_index, 'task': task})
@staff_member_required
def export_options(request, task_id, exporter_index):
    try:
        task = Task.objects.get(pk=task_id)
    except Task.DoesNotExist:
        raise Http404('Task does not exist')
    available_exporters = find_all_exporters(task.type)
    exporter = available_exporters[int(exporter_index)]()
    exporter.task = task
    if (request.method == 'POST'):
        form = exporter.get_form(data=request.POST)
        if form.is_valid():
            (success, message) = exporter.export(form)
            if success:
                messages.success(request, ('Export finished: ' + message))
            else:
                messages.error(request, ('Export failed: ' + message))
            return redirect('index')
    else:
        form = exporter.get_form()
    return render(request, 'annotationweb/export_options.html', {'form': form, 'exporter_index': exporter_index, 'task': task})