コード例 #1
0
def storeDriverData(request):
    if request.method == 'POST':
        form = details_ClientForm(request.POST)
        name = request.user.username

        if (form.is_valid()):
            cd = form.cleaned_data
            wd = driver(client_id=name,
                        firstname=cd['firstname'],
                        lastname=cd['lastname'],
                        email=cd['email'],
                        age=cd['age'],
                        phone=cd['phone'],
                        gender=cd['gender'],
                        client_is=cd['client_is'],
                        home=cd['home'])
            wd.save()
            print("Saved CarSharing record...")
            return HttpResponseRedirect('/profile/')  # Redirect after POST
        else:
            return render(request, 'add_PersonalDetails.html', {'form': form})

    print("should be calling status...")
    return render(request, 'status.html', {'term': "Profile Updated"})
コード例 #2
0
def addDriverData(request):
    form = details_ClientForm()
    return render(request, 'add_PersonalDetails.html', {'form': form})