Yes - but import captcha gives me ERROR: Could not import index.views.
Error was: No module named captcha
I have to put it somewhere and want to avoid adding it as Python
module but as local package

On 17 Lis, 10:28, MikeKJ <mike.jo...@paston.co.uk> wrote:
> you can use recaptcha directly in the form view
>
> add PUBLIC_KEY and PRIVATE_KEY to settings.py
>
> in the view of the form add
>
> import captcha
> from django.conf import settings
>
>     if request.method == "POST":
>         check_captcha =
> captcha.submit(request.POST['recaptcha_challenge_field'],
> request.POST['recaptcha_response_field'], settings.RECAPTCHA_PRIVATE_KEY,
> request.META['REMOTE_ADDR'])
>         if check_captcha.is_valid is False:
>             return HttpResponseRedirect('/user/register/')
>         userform = UserForm(request.POST) .......etc.....
>
>     html_captcha = captcha.displayhtml(settings.RECAPTCHA_PUBLIC_KEY)
>     return render_to_response("userprofile/join_form.html", {'userform':
> userform, 'content' : content, 'html_captcha': html_captcha,
>
> },context_instance=RequestContext(request))
>
> then in the template
>
> {{ userform.as_p }}
> {{ html_captcha }}
>
> <input type="submit" value="Join" id="joinSubmitButton" />
>
> --
> View this message in 
> context:http://old.nabble.com/Can-I-inport-recaptcha--tp30236419p30236526.html
> Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to