def add_client_info_from_req(req, order): new_shipping_info = dict_to_model(ShippingInformation, req['shipping_information']) order = Order.get_by_id(order.id) order.email = req['email'] order.shipping_information = new_shipping_info new_shipping_info.save() order.save()
def order_get(order_id): order = Order.get_or_none(Order.id == order_id) if order is None: raise ApiException(Errors.NOT_FOUND, "order") order_dict = model_to_dict(Order.get_by_id(order_id)) order_dict["product"] = { "id": order.product.product.id, "quantity": order.product.quantity } return jsonify(order_dict)