Exemplo n.º 1
0
def list_uber_request(request):
    if request.method == "GET":
        pendingrides = Pending_Ride.objects.all()
        serializer = PendingRideSerializer(pendingrides, many=True)
        return JSONResponse(serializer.data)

    elif request.method == "POST":
        data = JSONParser().parse(request)
        serializer = PendingRideSerializer(data=data)
        if serializer.is_valid():
            serializer.save()
            return JSONResponse(serializer.data, status=201)
        return JSONResponse(serializer.errors, status=400)
Exemplo n.º 2
0
def list_uber_request(request):
    if request.method == 'GET':
        pendingrides = Pending_Ride.objects.all()
        serializer = PendingRideSerializer(pendingrides, many=True)
        return JSONResponse(serializer.data)
        
    elif request.method == 'POST':
        data = JSONParser().parse(request)
        serializer = PendingRideSerializer(data=data)
        if serializer.is_valid():
            serializer.save()
            return JSONResponse(serializer.data, status=201)
        return JSONResponse(serializer.errors, status=400)
Exemplo n.º 3
0
def send_uber_request(request):
    serializer = PendingRideSerializer(data=request.GET)
    if serializer.is_valid():
        serializer.save()
        return JSONResponse(serializer.data, status=201)
    return JSONResponse(serializer.errors, status=400)
Exemplo n.º 4
0
def send_uber_request(request):
    serializer = PendingRideSerializer(data = request.GET)
    if serializer.is_valid():
        serializer.save()
        return JSONResponse(serializer.data, status=201)
    return JSONResponse(serializer.errors, status=400)