【发布时间】:2017-02-25 07:22:03
【问题描述】:
我遇到了一个错误, /accounts/tcresults 处的 AssertionError 未提供异常消息。 我写在 tc.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Score</title>
</head>
<body>
<h1>Score</h1>
<h2>Your Score is
{{ tcresults.tc }}
{{ value1 = tcresults.tc
if value1 > 5000:
<h2>Good</h2>
elseif value1 < 900:
<h2>Bad</h2>
}}
</h2>
</body>
</html>
在views.py中
def tc(request):
tcresults = ImageAndUser.objects.filter(user=request.user).order_by('id').last()
d = {
'tcresults': tcresults,
}
return render(request, 'registration/accounts/tc.html', d)
我不明白为什么会发生这个错误。 我应该怎么做才能解决这个问题?
【问题讨论】: