def post(self, request, *args, **kwargs): if request.is_ajax(): cart = get_cart(request) cart_action = self._get_operation(request) item_pk = self._get_item(request) request.session[u'cart'] = self._do_operation(cart, cart_action, item_pk) return HttpResponse('Operation Success!') else: return HttpResponseForbidden()
def post(self, request, *args, **kwargs): if request.is_ajax(): cart = get_cart(request) cart_action = self._get_operation(request) item_pk = self._get_item(request) request.session[u'cart'] = self._do_operation( cart, cart_action, item_pk) return HttpResponse('Operation Success!') else: return HttpResponseForbidden()
def get(self, request, *args, **kwargs): template_name = kwargs.get('template_name', settings.SHOPPING_CART_TEMPLATE) context = {u'cart': get_cart(request)} return render(request, template_name, context)