本文整理汇总了Python中models.Contact.all方法的典型用法代码示例。如果您正苦于以下问题:Python Contact.all方法的具体用法?Python Contact.all怎么用?Python Contact.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Contact
的用法示例。
在下文中一共展示了Contact.all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: contacts
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import all [as 别名]
def contacts():
if request.method == 'GET':
results = Contact.all()
json_results = []
for result in results:
d = {'id': result.key().id(),
'firstName': result.firstName,
'lastName': result.lastName,
'bday': result.bday,
'zodiac': result.zodiac}
json_results.append(d)
return jsonify(contacts=json_results)
示例2: get
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import all [as 别名]
def get(self):
answer = []
# Always put the default sender at the top.
defaultSender = Contact.getDefaultSender()
answer.append(defaultSender.toDict())
contacts = Contact.all()
contacts.filter('__key__ !=', defaultSender.key())
for contact in contacts:
answer.append(contact.toDict())
self.response.headers['Content-Type'] = 'application/json'
self.response.write(json.dumps(answer))
示例3: set_data_for
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import all [as 别名]
def set_data_for(self, group_id=None, search=None):
if search:
self.data = [("", tel.contact.name)
for tel in PhoneNumber.filter().group_by('contact')
if search.contact == tel.contact]
else:
self.data = [("", contact.name) for contact in Contact.all()]
if group_id:
if group_id == ALL_CONTACTS:
qs = ContactGroup.filter().group_by('contact')
else:
qs = ContactGroup.filter(group__id=group_id)
self.data = [("", contact_gp.contact.name) for contact_gp in qs]