From 73732cc7a1c8d4d2639cc23766f3692c794ed3cb Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Tue, 27 Jul 2021 13:53:07 +0200 Subject: [PATCH] Update create_books.py --- scripts/create_books.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/create_books.py b/scripts/create_books.py index 7939945..1815725 100644 --- a/scripts/create_books.py +++ b/scripts/create_books.py @@ -13,12 +13,13 @@ def run(): books = json.loads(file_books.read()) # Create books - for book in books: + for index, book in enumerate(books): Book( + id=index + 1, title=book['title'], author=book['author'], country=book['country'], year=book['year'], ).save() - print('Finish!') \ No newline at end of file + print('Finish!')