官方文档:https://django-simple-captcha.readthedocs.io/en/latest/usage.html
官方demo
1、forms.py中定义
from django import forms
from captcha.fields import CaptchaField
class CaptchaTestForm(forms.Form):
myfield = AnyOtherField()
captcha = CaptchaField()
2、views.py中引用
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())
输入’23‘,执行中的断点信息