本文整理汇总了Python中models.Player.update方法的典型用法代码示例。如果您正苦于以下问题:Python Player.update方法的具体用法?Python Player.update怎么用?Python Player.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Player
的用法示例。
在下文中一共展示了Player.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_player_position
# 需要导入模块: from models import Player [as 别名]
# 或者: from models.Player import update [as 别名]
def update_player_position(args, latitude, longitude):
player_id = get_player_id(args)
Player.update(
latitude=latitude,
longitude=longitude,
last_modified=datetime.now()
).where(Player.player_id == player_id).execute()
示例2: initialize_player_position
# 需要导入模块: from models import Player [as 别名]
# 或者: from models.Player import update [as 别名]
def initialize_player_position(args):
player_id = get_player_id(args)
start_position = get_pos_by_name(args.location)
if len(Player.select().where(Player.player_id == player_id)) == 0:
Player.create(
player_id=player_id,
name=args.username,
enabled=True,
last_modified=datetime.now(),
start_latitude=start_position[0],
start_longitude=start_position[1]
)
else:
Player.update(
last_modified=datetime.now(),
start_latitude=start_position[0],
start_longitude=start_position[1]
).where(Player.player_id == player_id).execute()