我想为使用cerberus的所有模型创建一些通用的验证机制。目标是在模型的__schema__属性中包含cerberus模式,并在每次模型状态更改时(不一定在插入或更新之前)使用该模式执行整个模型的验证。我想使用事件,但我不知道如何做,不要错过一些东西。
发布于 2017-03-24 14:25:45
根据您所描述的,您最好使用棉花糖而不是cerberus:
http://marshmallow.readthedocs.io/en/latest/examples.html#quotes-api-flask-sqlalchemy
https://stackoverflow.com/questions/42984695
复制相似问题