Update create_books.py
This commit is contained in:
parent
cfbafdfc99
commit
73732cc7a1
@ -13,12 +13,13 @@ def run():
|
|||||||
books = json.loads(file_books.read())
|
books = json.loads(file_books.read())
|
||||||
|
|
||||||
# Create books
|
# Create books
|
||||||
for book in books:
|
for index, book in enumerate(books):
|
||||||
Book(
|
Book(
|
||||||
|
id=index + 1,
|
||||||
title=book['title'],
|
title=book['title'],
|
||||||
author=book['author'],
|
author=book['author'],
|
||||||
country=book['country'],
|
country=book['country'],
|
||||||
year=book['year'],
|
year=book['year'],
|
||||||
).save()
|
).save()
|
||||||
|
|
||||||
print('Finish!')
|
print('Finish!')
|
||||||
|
Loading…
Reference in New Issue
Block a user