本文整理汇总了Python中model.User.User.query方法的典型用法代码示例。如果您正苦于以下问题:Python User.query方法的具体用法?Python User.query怎么用?Python User.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.User.User
的用法示例。
在下文中一共展示了User.query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GetUserId
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import query [as 别名]
def GetUserId(self):
if endpoints.get_current_user() == None:
raise endpoints.UnauthorizedException("Must log in")
user = User.query(User.username == endpoints.get_current_user().email()).get()
if user == None:
user = User(username = endpoints.get_current_user().email())
user.put()
return user.key
示例2: DeleteUser
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import query [as 别名]
def DeleteUser(self, request):
'''API method to delete current user and all his data'''
categories = Category.query(Category.user == self.GetUserId()).fetch()
for category in categories:
category.key.delete()
tasks = Task.query(Task.user == self.GetUserId()).fetch()
for task in tasks:
task.key.delete()
user = User.query(User.username == endpoints.get_current_user().email()).get()
user.key.delete()
return message_types.VoidMessage()