def index(): # This will serialize our data # `many=True` because there are many works, ie we expect a list schema = WorkSchema(many=True) works = Work.select() # get all the works return schema.dumps(works) # `schema.dumps` converts the list to JSON
def index(): schema = WorkSchema(many=True) works = Work.select() return schema.dumps(works)