def suggestioned_names_api(request): if request.method == 'GET': names = [{'label':i.name, 'value':i.name } for i in available_ghosts()] response = JsonResponse(names, safe=False) return response