Esempio n. 1
0
def completeOrder(request):
    request.session.set_expiry(0)
    cart = request.session['cart']
    order = Order()
    order.first_name = request.POST['first_name']
    order.last_name = request.POST['last_name']
    order.address = request.POST['address']
    order.city = request.POST['city']
    order.payment_method = request.POST['payment']
    order.payment_data = request.POST['payment_data']
    order.save()
    order.items = genItemsList(cart)
    request.session['cart'] = []
    return render(request, "complete_order.html", None)
Esempio n. 2
0
def completeOrder(request):
    request.session.set_expiry(0)
    cart = request.session['cart']
    ctx = {'cart': cart}
    order = Order()
    order.first_name = request.POST['first_name']
    order.last_name = request.POST['last_name']
    order.address = request.POST['address']
    order.city = request.POST['city']
    order.payment_method = request.POST['payment']
    order.payment_data = request.POST['payment_data']
    order.items = genItemsList(cart)
    order.fulfilled = False
    order.save()
    request.session['cart'] = []
    return render(request, 'store/complete_order.html', ctx)
Esempio n. 3
0
def completeOrder(request):
    cart = request.session['cart']
    request.session.set_expiry(0)
    ctx = {
        'cart': cart,
        'cart_size': len(cart),
        'cart_items': cartItems(cart),
        'total_price': priceCart(cart)
    }
    order = Order()
    order.items = genItemsList(cart)
    order.first_name = request.POST['first_name']
    order.last_name = request.POST['last_name']
    order.address = request.POST['address']
    order.city = request.POST['city']
    order.payment_data = request.POST['payment_data']
    order.fulfill = False
    order.payment_method = request.POST['payment']
    order.save()
    request.session['cart'] = []
    return render(request, "complete_order.html", ctx)