sqlalchemy监听事件
@event.listens_for(db.Model, 'before_update', propagate=True) def update_lasttime(mapper, connection, target): if hasattr(target, 'lasttime'): target.lasttime = datetime.now()
@event.listens_for(db.Model, 'before_update', propagate=True) def update_lasttime(mapper, connection, target): if hasattr(target, 'lasttime'): target.lasttime = datetime.now()