本文整理汇总了Python中models.Game.gql方法的典型用法代码示例。如果您正苦于以下问题:Python Game.gql方法的具体用法?Python Game.gql怎么用?Python Game.gql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Game
的用法示例。
在下文中一共展示了Game.gql方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DoGet
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import gql [as 别名]
def DoGet(self):
additional_values = {
'active_games': Game.gql("WHERE player_2 != NULL AND completed_date = NULL"),
'available_games': Game.gql("WHERE player_2 = NULL"),
'players' : self.get_players().fetch(7,0), # just the top players
'completed_games' : Game.all_completed().fetch(5,0) # just a few recently completed games
}
self.template_values.update(additional_values)
self.render_to_response("league.html")
示例2: get
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import gql [as 别名]
def get(self):
user = auth()
if user == None:
logging.debug("FetchGames: Entered unauthenticated user!!")
self.response.out.write(json.dumps({'error': 'Unauthenticated User'}))
return
point_of_origin = user.location
game_keys = Game.gql('WHERE active = :1',True)
active_games = game_keys.fetch(game_keys.count())
result = []
for g in active_games:
distance = geo.geomath.distance(point_of_origin, g.location)
if distance < g.range:
result.append({'lat': g.location.lat, 'lon': g.location.lon, 'gameid': int(g.key().id())})
self.response.out.write(json.dumps(result))
示例3: post
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import gql [as 别名]
def post(self):
user = auth()
if user == None:
self.response.out.write(json.dumps({'error': 'No autheticated user'}))
return
game = Game.gql("WHERE creator = :1", user)