From be0739614d8675169ebe192dba7ceb0b7580ef07 Mon Sep 17 00:00:00 2001 From: narzeja Date: Sat, 22 Oct 2016 08:52:37 +0200 Subject: [PATCH] better get example --- examples/sanic_peewee.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/sanic_peewee.py b/examples/sanic_peewee.py index b1ce4f38..d5479193 100644 --- a/examples/sanic_peewee.py +++ b/examples/sanic_peewee.py @@ -66,7 +66,11 @@ async def get(request): all_objects = await objects.execute(KeyValue.select()) serialized_obj = [] for obj in all_objects: - serialized_obj.append({obj.key: obj.text}) + serialized_obj.append({ + 'id': obj.id, + 'key': obj.key, + 'value': obj.text} + ) return json({'objects': serialized_obj})