本文整理汇总了Python中models.Match.loss方法的典型用法代码示例。如果您正苦于以下问题:Python Match.loss方法的具体用法?Python Match.loss怎么用?Python Match.loss使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Match
的用法示例。
在下文中一共展示了Match.loss方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: confirm_match
# 需要导入模块: from models import Match [as 别名]
# 或者: from models.Match import loss [as 别名]
def confirm_match(request, req_id=None):
if request.method == "POST":
if req_id is not None:
try:
sr = ScoreRequest.objects.get(id=req_id)
except:
return HttpResponseRedirect('/welcome/')
form = ConfirmRequestForm(request.POST, instance=sr)
print form
if form.is_valid() and sr.player2.user.username == request.user.username: #and needs to verify player2 is current player lol
form.save()
if int(request.POST['verified']) == 2:
#Save fields into a Match object now
match = Match()
match.player1 = sr.player1
match.player2 = sr.player2
match.wins = sr.wins
match.loss = sr.loss
match.ties = sr.ties
match.tournament = sr.tournament
match.save()
return HttpResponseRedirect('/welcome/')
return HttpResponseRedirect('/welcome/')
else:
print "Only POST requests for now"
return HttpResponseRedirect('/welcome/')