本文整理汇总了Python中model.group.Group.fav方法的典型用法代码示例。如果您正苦于以下问题:Python Group.fav方法的具体用法?Python Group.fav怎么用?Python Group.fav使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.group.Group
的用法示例。
在下文中一共展示了Group.fav方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insertExampleData
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import fav [as 别名]
def insertExampleData(self):
self.getSession()
g1 = Group("Group 1")
g2 = Group("Group 2")
g2.fav = True
t1 = Track("Bob", "Hello World!", False, 1)
t2 = Track("Joe", "How are you doing?", True, 3)
t3 = Track("Jim", "Can't stop dancing", False, 5)
t4 = Track("Tom", "A simple melody", True, 9)
gt1_1 = GroupTrack(1, 0, 100)
gt1_1.track = t1
gt1_2 = GroupTrack(2, 100, 200)
gt1_2.track = t2
g1.grouptracks.append(gt1_1)
g1.grouptracks.append(gt1_2)
gt2_2 = GroupTrack(1, 0, 200)
gt2_2.track = t2
gt2_3 = GroupTrack(2, 200, 150)
gt2_3.track = t3
g2.grouptracks.append(gt2_2)
g2.grouptracks.append(gt2_3)
self.session.add_all([g1, g2, t1, t2, t3, t4, gt1_1, gt1_2, gt2_2, gt2_3])
self.session.commit()
示例2: newgroup
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import fav [as 别名]
def newgroup(self, name):
'''
create a group and insert it to the list in the position
'''
self._checksession()
g = Group(name)
g.fav = True
self.lst.append(g)
self.session.add(g)
self.session.commit()
self.resort()
return self.lst.index(g)
示例3: store
# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import fav [as 别名]
def store(self, stats):
'''
store every item in the list according to the data in it
this might create a group, grouptracks and tracks
'''
ss = self.model.getSession()
gg = None
if not self.name is None and self.name.strip() != "":
gg = Group(self.name)
gg.fav = self.fav
ss.add(gg)
ss.flush()
ss.merge(gg) # merge the idno
for ee in self.lst:
tt = None
if ee.track == True:
tt = ee.createTrack()
ss.add(tt)
stats.inctotal()
elif ee.track != None:
ee.applyToTrack()
tt = ee.track
if tt != None and gg != None:
gt = ee.createGroupTrack()
ss.add(gt)
gt.track = tt
gg.grouptracks.append(gt)
ss.commit()
if gg:
if ((gg.idno is None) or (gg.idno == 0) or (not isinstance(gg.idno, int))):
raise Exception("IDNO == None or something else")
return gg.idno
return None