本文整理汇总了Python中models.Player.logged_in_player方法的典型用法代码示例。如果您正苦于以下问题:Python Player.logged_in_player方法的具体用法?Python Player.logged_in_player怎么用?Python Player.logged_in_player使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Player
的用法示例。
在下文中一共展示了Player.logged_in_player方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: form_valid
# 需要导入模块: from models import Player [as 别名]
# 或者: from models.Player import logged_in_player [as 别名]
def form_valid(self, form):
def grab(s):
return form.cleaned_data[s]
m = Meal(
eater=Player.logged_in_player(self.request),
eaten=Player.current_players().get(feed=grab("feedcode")),
time=grab("time"),
location=grab("location"),
description=grab("description"),
)
m.full_clean()
m.save()
return super(EatView, self).form_valid(form)
示例2: form_valid
# 需要导入模块: from models import Player [as 别名]
# 或者: from models.Player import logged_in_player [as 别名]
def form_valid(self,form):
def grab(s):
return form.cleaned_data[s]
donatingPlayer = Player.logged_in_player(self.request)
receivingPlayer = grab('receiver')
brains = grab('numberOfMeals')
donatingPlayer.brains -= brains
receivingPlayer.brains += brains
donatingPlayer.save()
receivingPlayer.save()
return super(DonateView, self).form_valid(form)