Update create_books.py

This commit is contained in:
Andros Fenollosa 2021-07-27 13:53:07 +02:00 committed by GitHub
parent cfbafdfc99
commit 73732cc7a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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!')
print('Finish!')