验证码
在github中搜验证码,那个有使用文档
# pip install django-simple-captcha==0.4.6
# setting app
captcha
# url
url(r'^captcha/', include('captcha.urls')),
# 运用migration 和 migrate生成验证码的表
# forms一个验证form类的字段
# 异常字典中这个字段是固定的
captcha = CaptchaField(error_messages={'invalid': u'验证码错误'})
# html中在验证码的范围内写
<label>验 证 码</label>
{{ register_form.captcha }}
# view
def get(self, request):
register_form = RegisterForm()
return render(request, 'register.html', {'register_form':register_form})