本文整理匯總了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)