本文整理汇总了Python中models.Album.select方法的典型用法代码示例。如果您正苦于以下问题:Python Album.select方法的具体用法?Python Album.select怎么用?Python Album.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Album
的用法示例。
在下文中一共展示了Album.select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from models import Album [as 别名]
# 或者: from models.Album import select [as 别名]
# edit_data.py
import peewee
from models import Album, Artist
band = Artist.select().where(Artist.name=="Kutless").get()
print (band.name)
# shortcut method
band = Artist.get(Artist.name=="Kutless")
print (band.name)
# change band name
band.name = "Beach Boys"
band.save()
album = Album.select().join(Artist).where(
(Album.title=="Thrive") & (Artist.name == "Newsboys")
).get()
album.title = "Step Up to the Microphone"
album.save()
示例2: index
# 需要导入模块: from models import Album [as 别名]
# 或者: from models.Album import select [as 别名]
def index(self):
albums = Album.select()
return self.render('admin/gallery.html', albums=albums)
示例3:
# 需要导入模块: from models import Album [as 别名]
# 或者: from models.Album import select [as 别名]
from models import Album, Artist
query = Album.select().join(Artist)
qry_filter = (Album.title=="Step Up to the Microphone") & (Artist.name == "Newsboys")
album = query.where(qry_filter).get()
print (album)