def view_card(request): card = Card(request) products = card.shopping_card data = [] for product in products: pd = Product.objects.get(pk = int(product["product_id"])) data.append({"id" : pd.id, "image" : pd.image.url, 'name' : pd.name, 'price' : pd.price1, 'num' : product["num"], 'amount' : pd.price1 * int(product["num"])}) return render_to_response("card/card.html", {'items' : data}, context_instance=RequestContext(request))
def update_product(request, product_id, num): card = Card(request) card.update(product_id, int(num), 1) return HttpResponse("okie")
def index(request, product_id, size): #Check if user logging card = Card(request) card.add(product_id, 1, size) return render_to_response('card/card.html', {'card': card.shopping_card}, context_instance=RequestContext(request))
def remove_product(request, product_id): card = Card(request) card.remove(product_id) return HttpResponse("okie")
def my_shopping_card(request): card = Card(request) return render_to_response('card/card.html', {'card': card.shopping_card}, context_instance=RequestContext(request))