本文整理汇总了Python中models.Record.put方法的典型用法代码示例。如果您正苦于以下问题:Python Record.put方法的具体用法?Python Record.put怎么用?Python Record.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Record
的用法示例。
在下文中一共展示了Record.put方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_user
# 需要导入模块: from models import Record [as 别名]
# 或者: from models.Record import put [as 别名]
def create_user(self, request):
"""Create a User"""
# Checks if user provided user name exists in database
if User.query(User.name == request.user_name).get():
raise endpoints.ConflictException(\
'A User with that name already exists!')
# Creates new player record and user
# based on user inputed name and email
user = User(name=request.user_name,
email=request.email)
user.put()
record = Record(user=user.key,
wins=0,
loses=0)
record.put()
return StringMessage(message='User {} created!'.format(request.user_name))