本文整理汇总了Python中models.Group.select方法的典型用法代码示例。如果您正苦于以下问题:Python Group.select方法的具体用法?Python Group.select怎么用?Python Group.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Group
的用法示例。
在下文中一共展示了Group.select方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import select [as 别名]
def __init__(self, table_group, parent, *args, **kwargs):
QDialog.__init__(self, parent, *args, **kwargs)
self.parent = table_group
group_id = self.parent.table_group.group.group_id
self.group = Group.select().where(Group.id == group_id).get()
vbox = QVBoxLayout()
vbox.addWidget(FBoxTitle(
u"<h3>Groupe: {}</h3>".format(self.group.name)))
self.order_number = LineEdit()
# form transfer
self.amount = LineEdit()
self.amount.setFont(QFont("Arial", 15))
self.amount.setValidator(QIntValidator())
self.amount.setToolTip(u"Taper le montant du transfert")
# self.solde = FLabel(get_solde())
self.amount_error = ErrorLabel(u"")
send_butt = Button(u"Envoyer")
send_butt.clicked.connect(self.sender)
cancel_but = Button(u"Annuler")
cancel_but.clicked.connect(self.cancel)
formbox = QGridLayout()
formbox.addWidget(FLabel(u"Montant: "), 0, 0)
formbox.addWidget(self.amount, 0, 1)
formbox.addWidget(send_butt, 2, 1)
formbox.addWidget(cancel_but, 2, 0)
vbox.addLayout(formbox)
self.setLayout(vbox)
示例2: popup
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import select [as 别名]
def popup(self, pos):
row = self.selectionModel().selection().indexes()[0].row()
if (len(self.data) - 1) < row:
return False
self.contact = Contact.get(Contact.number == int(self.data[row][2]))
menu = QMenu()
menu.addAction(QIcon("{}transfer.png".format(Config.img_media)),
u"Faire un envoi", lambda: self.send_money(self.contact))
menu.addAction(QIcon("{}edit_contact.png".format(Config.img_media)),
u"modifier le contact", lambda: self.edit_contacts(self.contact))
addgroup = menu.addMenu(u"Ajouter au groupe")
delgroup = menu.addMenu(u"Enlever du groupe")
# # Enlever du groupe
no_select = ContactGroup.filter(contact__number=int(self.data[row][2]))
[delgroup.addAction(u"{}".format(grp_ct.group.name), lambda grp_ct=grp_ct: self.del_grp(
grp_ct)) for grp_ct in no_select]
# # Ajout au groupe
lt_grp_select = [(i.group.name) for i in no_select]
[addgroup.addAction(u"{}".format(grp.name), lambda grp=grp: self.add_grp(grp))
for grp in Group.select() if not grp.name in lt_grp_select]
self.action = menu.exec_(self.mapToGlobal(pos))
self.refresh()
示例3: save_form
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import select [as 别名]
def save_form(self):
if not self.iscomplet():
return
full_name = unicode(self.full_name.text())
phone_number = int(self.phone_number.text().replace('.', ''))
try:
Contact(number=phone_number, name=full_name).save()
except:
self.msg_e_or_c.setText(u"Ce numéro existe déjà")
self.msg_e_or_c.setStyleSheet("color: red")
return
grp = unicode(self.list_grp[self.combo_grp.currentIndex()])
if not grp == "Aucun":
grp = Group.select().where(Group.name == grp).get()
contact = Contact.select().where(Contact.number == phone_number).get()
ContactGroup(group=grp.id, contact=contact).save()
self.full_name.setText("")
self.phone_number.setText("")
self.msg_e_or_c.setText(u"Le numéro (<b>{}</b>) à éte bien enregistré"
.format(phone_number))
示例4: __init__
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import select [as 别名]
def __init__(self, table_group, parent, *args, **kwargs):
QDialog.__init__(self, parent, *args, **kwargs)
self.parent = table_group
group_id = self.parent.table_group.group.group_id
self.group = Group.select().where(Group.id == group_id).get()
vbox = QVBoxLayout()
vbox.addWidget(FBoxTitle(
u"<h2>Envoi pour les ({0}) contactes du groupe <b>{1}</b></h2>".format(len(self.group.contacts), self.group.name)))
# form transfer
self.amount = LineEdit()
self.amount.setFont(QFont("Arial", 15))
self.amount.setValidator(QIntValidator())
self.amount.setToolTip(u"Taper le montant du transfert")
self.amount_error = ErrorLabel(u"")
self.password_field = EnterTabbedLineEdit()
self.password_field.setEchoMode(LineEdit.Password)
self.password_field.setToolTip(u"Taper le code orange money")
self.send_butt = Button(u"Envoyer")
self.send_butt.clicked.connect(self.sender)
cancel_but = Button(u"Annuler")
cancel_but.clicked.connect(self.cancel)
formbox = QGridLayout()
formbox.addWidget(FLabel(u"Montant: "), 0, 0)
formbox.addWidget(self.amount, 0, 1)
formbox.addWidget(FLabel(u"Code: "), 1, 0)
formbox.addWidget(self.password_field, 1, 1)
formbox.addWidget(self.send_butt, 2, 1)
formbox.addWidget(cancel_but, 2, 0)
self.isvalid()
vbox.addLayout(formbox)
self.setLayout(vbox)
示例5: refresh_
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import select [as 别名]
def refresh_(self):
""" Rafraichir la liste des groupes"""
self.clear()
self.addItem(GroupQListWidgetItem(ALL_CONTACTS))
for group in Group.select():
self.addItem(GroupQListWidgetItem(group))
示例6: get_groups_for_user
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import select [as 别名]
def get_groups_for_user(self, user):
q = Group.select(Group).join(Subscription).join(User).where(User.id == user.id).distinct().naive()
result = [{'id':s.id,'title':s.title} for s in q]
return result
示例7: groups
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import select [as 别名]
def groups():
return render_template('groups.html', groups=Group.select())