使用django-simple-captcha时,表单有效为何human = True
根据文档中的内容,验证表单的部分显示了以下内容:
def some_view(request):
if request.POST:
form = CaptchaTestForm(request.POST)
# Validate the form: the captcha field will automatically
# check the input
if form.is_valid():
human = True
else:
form = CaptchaTestForm()
return render_to_response('template.html',locals())
问题:代码中的"human = True"是什么意思?它只是一个解释或者注释,表示“人类输入的验证码是正确的”吗?
1 个回答
2
"human = True"
这行代码的意思是,在那个 if
语句里,你可以确定验证码已经成功填写了。你可以把这一行改成你正常代码中的内容,以便保存表单。