def process_request(request, order: cmod.Order = None): if order is not None and order.num_items() > 0 and order.status == "cart": HttpResponseRedirect('/homepage/') items = order.active_items(False) tax = order.get_item(cmod.Product.objects.get(name="Sales Tax")) for i in items: i.recalculate() order.recalculate() if order.num_items() < 2: HttpResponseRedirect('/catalog/') context = {'items': items, 'order': order, 'tax': tax} return request.dmp.render('cart.html', context) else: return HttpResponseRedirect('/catalog/')
def process_request(request, orderItem: cmod.OrderItem, order: cmod.Order): orderItem.status = 'deleted' orderItem.save() order.recalculate() if order.num_items() < 1: return HttpResponseRedirect('/catalog/') else: return HttpResponseRedirect('/catalog/cart/' + str(order.id))