flask orm 对象序列化
def orm_serialize(item) -> dict:
if item:
try:
return {c.name: getattr(item, c.name) for c in item.__table__.columns}
except:
return {}
else:
return {}
def orm_serialize(item) -> dict:
if item:
try:
return {c.name: getattr(item, c.name) for c in item.__table__.columns}
except:
return {}
else:
return {}