本文整理汇总了Python中models.Member.select方法的典型用法代码示例。如果您正苦于以下问题:Python Member.select方法的具体用法?Python Member.select怎么用?Python Member.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Member
的用法示例。
在下文中一共展示了Member.select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testManyToManyOperation
# 需要导入模块: from models import Member [as 别名]
# 或者: from models.Member import select [as 别名]
def testManyToManyOperation(self):
team = Team.create(name="Houkago Tea Time")
for name in self.names:
team.members.append(first_name=name[0], last_name=name[1], part=name[2], age=name[3])
song1 = Song.create(name="Utauyo!! MIRACLE")
song2 = Song.create(name="Tenshi ni Fureta yo!")
for m in Member.all(): song1.members.append(m)
for m in Member.select(age=17): song2.members.append(m)
members = song1.members
self.assertEqual(members.count(), 5)
members = song2.members
self.assertEqual(members.count(), 4)
azusa = Member.get(first_name="Azusa")
songs = azusa.songs
self.assertEqual(songs.count(), 1)
self.assertEqual(songs[0].name, "Utauyo!! MIRACLE")
示例2: render_members
# 需要导入模块: from models import Member [as 别名]
# 或者: from models.Member import select [as 别名]
def render_members():
members = Member.select().order_by(Member.last_name.asc())
return render_template_with_user("members.html", members=members)