示例#1
0
 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
示例#2
0
 def get_queryset(self):
     return Cart.get_with_product()
示例#3
0
 def get_queryset(self):
     return Cart.get_with_product().filter(pk__in=self.get_cart_ids())
示例#4
0
 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
示例#5
0
 def get_queryset(self):
     return Cart.get_with_product().filter(
         session_id=self.get_session_key())