当前位置:   article > 正文

django之验证码django-simple-captcha_django 中captcha验证码可以设置字体颜色吗?

django 中captcha验证码可以设置字体颜色吗?

官方文档:https://django-simple-captcha.readthedocs.io/en/latest/usage.html

官方demo

1、forms.py中定义

  1. from django import forms
  2. from captcha.fields import CaptchaField
  3. class CaptchaTestForm(forms.Form):
  4. myfield = AnyOtherField()
  5. captcha = CaptchaField()

2、views.py中引用

  1. def some_view(request):
  2. if request.POST:
  3. form = CaptchaTestForm(request.POST)
  4. # Validate the form: the captcha field will automatically
  5. # check the input
  6. if form.is_valid():
  7. human = True
  8. else:
  9. form = CaptchaTestForm()
  10. return render_to_response('template.html',locals())
'
运行

输入’23‘,执行中的断点信息

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/982977
推荐阅读
相关标签
  

闽ICP备14008679号