Thursday, March 23, 2017

Re: Django Captcha or MathCaptcha application


Belowe the steps i have followed, but it doesnt work. I type in my browser : www.localhost/capthca but no image is displayeded and i get an error : no such table: captcha_captchastore

I dont find it very simple as suggested from documentation. Do you have any simple tutorial?

1.    pip install captcha, pillow

2.    edit setting.py in installed app to mention 'captcha'

3.    after that add URL to urls.py,url(r'^captcha/', include('captcha.urls'))
        should captcha.urls contain any row????

4.  forms.py:

    from captcha.fields import CaptchaField

    class CaptchaTestForm(forms.Form):
    captcha = CaptchaField()


5.  Submit and change the captcha .html file
{% load tags %}
{% load static %}
{% autoescape off %}

<html>
<head>
<form action='./captcha' method='POST'>{%csrf_token%}
    {{form}}
     <input id="js-captcha-refresh" class="js-captcha-refresh" value="Invio" type="submit">
</form>
</head>
</html>
{% endautoescape %}

views.py

def captcha(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
            HttpResponse("passa")
        else:
            form = CaptchaTestForm()
    else:
        form = CaptchaTestForm()       
    return render_to_response('captcha.html', {'form':form}, context_instance=RequestContext(request))


On Wednesday, March 22, 2017 at 3:41:10 PM UTC+1, Thiago Parolin wrote:
I am using django-recaptcha2, that is a google recaptcha...
Very simple to setup and use and works very well

2017-03-22 11:20 GMT-03:00 valerio orfano <ingor...@gmail.com>:
Hi

i am trying to apply captcha process to my web site. I could find any clear documentation out there (at least clear to me). Do you know any simple step by step tutorial or captcha application source code you have already created and that works fine?

I am looking for code regarding view, urls, template, form and class snippet.

Thanx for your support

valerio

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/28e5169e-6800-4b85-ba3f-63f3621e85c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a1cf4ab3-d41a-4cbe-a5fb-cff0a08fa5ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment