Exemplo n.º 1
0
def storeCarSharingData(request):
    if request.method == 'POST':
        form = routeForm(request.POST)
        name = request.user.username

        if (form.is_valid()):
            cd = form.cleaned_data

            wd = route(driver_id=name,
                       journey_name=cd['journey_name'],
                       from_place=cd['from_place'],
                       to_place=cd['to_place'],
                       time=cd['time'],
                       price=cd['price'],
                       seats_free=cd['seats_free'],
                       car_desc=cd['car_desc'],
                       deviate=cd['deviate'])
            wd.save()
            print("Saved CarSharing record...")
            return HttpResponseRedirect('/profile/')  # Redirect after POST
        else:
            return render(request, 'wdata_form.html', {'form': form})

    print("should be calling status...")
    return render(request, 'status.html', {'term': "Saved data to d/base..."})
Exemplo n.º 2
0
def storeCarSharingData(request):
    if request.method == 'POST':
        form = routeForm(request.POST)

        if (form.is_valid()):
            cd = form.cleaned_data

            wd = route(journey_name=cd['journey_name'],
                       from_place=cd['from_place'],
                       to_place=cd['to_place'],
                       time=cd['time'],
                       price=cd['price'],
                       seats_free=cd['seats_free'],
                       car_desc=cd['car_desc'],
                       deviate=cd['deviate'])
            wd.save()
            print("Saved CarSharing record...")
        else:
            return render(request, 'wdata_form.html', {'form': form})

    print("should be calling status...")
    return render(request, 'status.html', {'term': "Saved data to d/base..."})
Exemplo n.º 3
0
def addCarSharingData(request):
    form = routeForm()
    return render(request, 'wdata_form.html', {'form': form})