def get_context_data(self, *, object_list=None, **kwargs): if not self.request.session.session_key: self.request.session.save() session = Session.objects.get(session_key=self.request.session.session_key) context = super().get_context_data(object_list=object_list, **kwargs) context['cart_total'] = Cart.get_cart_total(session=session) context['form'] = OrderForm() context['cart'] = context['cart'].filter(session=session) return context
def get_queryset(self): return Cart.get_with_product()
def get_queryset(self): return Cart.get_with_product().filter(pk__in=self.get_cart_ids())
def get_context_data(self, *, object_list=None, **kwargs): context = super().get_context_data(object_list=object_list, **kwargs) context['cart_total'] = Cart.get_cart_total(ids=self.get_cart_ids()) context['form'] = OrderForm() return context
def get_queryset(self): return Cart.get_with_product().filter( session_id=self.get_session_key())