本文整理汇总了Python中models.Album.insert_many方法的典型用法代码示例。如果您正苦于以下问题:Python Album.insert_many方法的具体用法?Python Album.insert_many怎么用?Python Album.insert_many使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Album
的用法示例。
在下文中一共展示了Album.insert_many方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Album
# 需要导入模块: from models import Album [as 别名]
# 或者: from models.Album import insert_many [as 别名]
album_one = Album(artist=new_artist,
title="Read All About It",
release_date=datetime.date(1988, 12, 1),
publisher="Refuge",
media_type="CD")
album_one.save()
albums = [{"artist": new_artist,
"title": "Hell is for Wimps",
"release_date": datetime.date(1990,7,31),
"publisher": "Sparrow",
"media_type": "CD"
},
{"artist": new_artist,
"title": "Love Liberty Disco",
"release_date": datetime.date(1999,11,16),
"publisher": "Sparrow",
"media_type": "CD"
},
{"artist": new_artist,
"title": "Thrive",
"release_date": datetime.date(2002,3,26),
"publisher": "Sparrow",
"media_type": "CD"}
]
Album.insert_many(albums).execute()
bands = ["MXPX", "Kutless", "Thousand Foot Krutch"]
for band in bands:
artist = Artist.create(name=band)
artist.save()