Skip to content

Instantly share code, notes, and snippets.

@sloria
Created October 20, 2014 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sloria/8b92ffd50fbf8efaae02 to your computer and use it in GitHub Desktop.
Save sloria/8b92ffd50fbf8efaae02 to your computer and use it in GitHub Desktop.
from marshmallow import Schema, fields
class FooSchema(Schema):
author_name = fields.Nested('UserSerializer')
class Meta:
fields = ('id', 'author_name')
foos = Foo.query.all()
schema = FooSchema(many=True)
d = schema.dump(foos).data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment