def get(order_id): """ Get item from id """ coll = Order.collection() dic = coll.find_one({"_id": order_id}) return Order.unserialize(dic) if dic is not None else None
def new(user_id): o = Order() o.user_id = user_id o.status = OrderStatus.NEW return o
def get_all(user_id): coll = Order.collection() dic_lis = coll.find({ "user_id": user_id }) return [Order.unserialize(d) for d in dic_lis]