@staff_member_required
def import_options(request, dataset_id, importer_index):
    try:
        dataset = Dataset.objects.get(pk=dataset_id)
    except Dataset.DoesNotExist:
        raise Http404('Dataset does not exist')
    available_importers = find_all_importers()
    importer = available_importers[int(importer_index)]()
    importer.dataset = dataset
    if (request.method == 'POST'):
        form = importer.get_form(data=request.POST)
        if form.is_valid():
            (success, message) = importer.import_data(form)
            if success:
                messages.success(request, ('Import finished: ' + message))
            else:
                messages.error(request, ('Import failed: ' + message))
            return redirect('index')
    else:
        form = importer.get_form()
    return render(request, 'annotationweb/import_options.html', {'form': form, 'importer_index': importer_index, 'dataset': dataset})
@staff_member_required
def import_options(request, dataset_id, importer_index):
    try:
        dataset = Dataset.objects.get(pk=dataset_id)
    except Dataset.DoesNotExist:
        raise Http404('Dataset does not exist')
    available_importers = find_all_importers()
    importer = available_importers[int(importer_index)]()
    importer.dataset = dataset
    if (request.method == 'POST'):
        form = importer.get_form(data=request.POST)
        if form.is_valid():
            (success, message) = importer.import_data(form)
            if success:
                messages.success(request, ('Import finished: ' + message))
            else:
                messages.error(request, ('Import failed: ' + message))
            return redirect('index')
    else:
        form = importer.get_form()
    return render(request, 'annotationweb/import_options.html', {'form': form, 'importer_index': importer_index, 'dataset': dataset})