我有以下架构:
class PublisherSchema(ma.SQLAlchemyAutoSchema):
class Meta:
fields = ('name',)
model = Publisher
class JournalSchema(ma.SQLAlchemyAutoSchema):
class Meta:
fields = ('title', 'publisher')
model = Journal
ordered = True
publisher = ma.Nested(PublisherSchema)
当我转储 JournalSchema 时,我希望结果是:
{
"title": "hello",
"publisher: "bye"
}
但现在它转储为:
{
"title": "hello",
"publisher": {
"name": "bye"
}
}
如何嵌套发布者值但不显示密钥?