Skip to content

Commit

Permalink
Merge pull request #35 from juntatalor/juntatalor-patch-return_id_list
Browse files Browse the repository at this point in the history
Fix return_id_list()
  • Loading branch information
rudyryk committed Sep 5, 2016
2 parents 515f3e5 + acd306e commit 743b1e9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion peewee_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,10 @@ def insert(query):
cursor = yield from _execute_query_async(query)

if query.is_insert_returning:
result = (yield from cursor.fetchone())[0]
if query._return_id_list:
result = map(lambda x: x[0], (yield from cursor.fetchall()))
else:
result = (yield from cursor.fetchone())[0]
else:
result = yield from query.database.last_insert_id_async(
cursor, query.model_class)
Expand Down

0 comments on commit 743b1e9

Please sign in to comment.