本文整理汇总了Python中models.Game.get_form方法的典型用法代码示例。如果您正苦于以下问题:Python Game.get_form方法的具体用法?Python Game.get_form怎么用?Python Game.get_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Game
的用法示例。
在下文中一共展示了Game.get_form方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_game
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import get_form [as 别名]
def get_game(self, request):
"""
gets a single game
"""
game = get_by_urlsafe(request.urlsafeKey, Game)
if game == 'Invalid Key':
game = Game()
return game.get_form(message="Game not found.")
else:
return game.get_form(message="game retrieved.")
示例2: get_history
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import get_form [as 别名]
def get_history(self, request):
"""
gets the user's game history.
"""
user = User.query(User.name == request.name).get()
if user is None:
game = Game()
game.get_form(message="User can not be found")
return UsersGames(items=game)
else:
games = Game.query(Game.user == user.key)
return UsersGames(items=[i.get_form() for i in games])
示例3: newGame
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import get_form [as 别名]
def newGame(self, request):
"""
args: choice - contains the users guessed letter
creates a new game
returns: user - urlsafekey based off of the users key
hint - definitin of the word
word - a randomly generated word
progress - astericks string that is as long as the word
"""
game = Game()
user = User.query(User.name == request.user_name).get()
if not user:
return game.get_form(message="That user does not exist")
else:
game = Game.new_game(user.key)
return game.get_form(message="Good luck!")