Beispiel #1
0
def getCity(request, continent, country, city):
    if '' == request.GET:
        return HttpResponse(status=400)

    try:
        queryset = Object.objects.filter(Name=continent and country and city)
        serializer = ObjectSerializers(queryset, many=True)
        return JsonResponse(serializer.data,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    except:
        return HttpResponse(status=500)
Beispiel #2
0
def getContinents(request):
    if '' == request.GET:
        return HttpResponse(status=400)

    try:
        queryset = Object.objects.filter(Type=0)
        print(queryset)
        serializer = ObjectSerializers(queryset, many=True)
        print(serializer.data)
        return JsonResponse(serializer.data,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    except:
        return HttpResponse(status=500)