def post(self, request): user_id = request.session['user_id'] goods_id = request.POST.get('goods_id') goods_num = request.POST.get('goods_num') order = Orders() order.order_id = uuid.uuid4().hex order.time = datetime.datetime.now() order.goods_num = goods_num order.goods = Goods.objects.get(id=goods_id).name order.user = User.objects.get(id=user_id).name order.price = Goods.objects.get(id=goods_id).price * goods_num