【发布时间】:2016-10-09 00:52:06
【问题描述】:
如果我有架构,请使用 Python、Flask 和棉花糖:
class ParentSchema(Schema):
id = fields.Int(dump_only=True)
children = fields.Nested('ChildSchema', dump_only=True)
还有一个类Parent,它有一个方法:
class Parent():
getChildren(self, params):
pass
如何让 Marshmallow 在序列化对象时将必要的参数传递给Parent.getChildren,然后用结果填充ParentSchema.children?
【问题讨论】: