def external(request): if request.method == 'POST': pk = request.POST.get('server_pk') pull_vdn_list(pk) context = { 'servers': VDNServer.objects.all(), 'available_datasets': {server: json.loads(server.last_response_datasets) for server in VDNServer.objects.all()}, 'available_detectors': {server: json.loads(server.last_response_detectors) for server in VDNServer.objects.all()}, 'vdn_datasets': VDNDataset.objects.all(), 'vdn_detectors': VDNDetector.objects.all() } return render(request, 'external_data.html', context)