本文整理汇总了Python中models.Group.all方法的典型用法代码示例。如果您正苦于以下问题:Python Group.all方法的具体用法?Python Group.all怎么用?Python Group.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Group
的用法示例。
在下文中一共展示了Group.all方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pending_join
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def pending_join(self):
"""Returns True if the user is pending approval to join a group."""
for group in Group.all():
for user in group.pending_users:
if user.user_id() == self.user_id:
return True
return False
示例2: getGroups
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def getGroups(id):
query = Group.all()
if id:
query = query.filter('parentGroup =', db.Key(id)) # XXX exceptions
query.order('name')
groups = []
for g in query.fetch(1000):
gg = g.json()
try:
gg['parent'] = g.parentGroup.key().__str__() if g.parentGroup else None
except Exception:
continue
groups.append(gg)
return groups
示例3: get
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def get(self, username):
if username == 'mine':
user = User.get_current_user()
else:
user = get1_by_property(User, 'name', username)
if user:
balances = self.get_balances(user)
self.generate('user_profile.html',
{'user':user,
'balances':balances,
'groups':Group.all(),
'vendors':Vendor.all()})
else:
self.redirect('/oops/invalid_user')
示例4: __init__
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def __init__(self, parent, *args, **kwargs):
QDialog.__init__(self, parent, *args, **kwargs)
vbox = QVBoxLayout()
vbox.addWidget(FBoxTitle(u"<h3>Ajout de contact </h3>"))
self.combo_grp = QComboBox()
groups = Group()
groups.name = "Aucun"
self.list_grp = Group.all()
self.list_grp.append(groups)
self.list_grp.reverse()
for index in self.list_grp:
sentence = u"%(name)s" % {'name': index.name}
self.combo_grp.addItem(sentence)
self.full_name = LineEdit()
self.msg_e_or_c = FLabel("")
self.full_name.setFont(QFont("Arial", 16))
self.phone_number = IntLineEdit()
self.phone_number.setInputMask("D9.99.99.99")
self.phone_number.setAlignment(Qt.AlignCenter)
self.phone_number.setFont(QFont("Arial", 16))
send_butt = Button(u"Enregistrer")
send_butt.clicked.connect(self.save_form)
cancel_but = Button(u"Fermer")
cancel_but.clicked.connect(self.cancel)
formbox = QGridLayout()
formbox.addWidget(FLabel(u"Groupes:"), 0, 0)
formbox.addWidget(self.combo_grp, 1, 0)
formbox.addWidget(FLabel(u"Nom complèt: "), 0, 1)
formbox.addWidget(self.full_name, 1, 1)
formbox.addWidget(FLabel(u"Numéro: "), 0, 2)
formbox.addWidget(self.phone_number, 1, 2)
formbox.addWidget(send_butt, 2, 1)
formbox.addWidget(cancel_but, 2, 0)
formbox.addWidget(self.msg_e_or_c, 3, 0, 3, 2)
vbox.addLayout(formbox)
self.setLayout(vbox)
示例5: post
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def post(self):
data = UserForm(data=self.request.POST)
logging.info(self.request.POST)
if not data.is_valid():
self.redirect('/u/register')
else:
user = data.save(commit=False)
if not exists_by_property(User, 'name', user.name):
user.who = users.get_current_user()
user.put()
for group in self.request.POST.getall('group'):
user.join(Group.get_by_id(group))
self.redirect('/u/%s/profile' % user.name)
else:
logging.debug('user %s already exists!' % user.name)
self.generate('add_user.html',
{'form':data,
'groups':Group.all()})
示例6: get
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def get(self):
"""Displays a list of all groups."""
return self.render('groups_list', {'groups': Group.all()})
示例7: group
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def group(self):
"""The group the user belongs to, or None."""
for group in Group.all():
if self.gae_user in group.members:
return group
return None
示例8: get
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def get(self):
return self.render('groups_list', { 'groups': Group.all() })
示例9: get
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import all [as 别名]
def get(self):
self.generate("list_group.html",
{"groups":list(Group.all())})