Coukies django python cart

How can i do a cart for a long time on django-python using cookies please response to me !! it's an emergency def Cart(request) try: customer = request.user.customer except: device = request.COOKIES['device'] customer, created = Customer.objects.get_or_create(device=device) order, created = Order.objects.get_or_create(customer=customer,complete=False) # print(order.product) categories = Category.objects.all() context={'order':order,'categories':categories} response = render (request,'store/cart.html',context) set_cookie(response, 'cart',device) return response

Back to Top