views:

317

answers:

1

New to django and trying to setup django-registration 0.8 with recaptcha-client. I followed the advice posted in the answer to this question.

I used the custom form and custom backend from that post and the widget and field from this tutorial. My form is displaying properly with the recaptcha widget but when I submit it throws the error about the missing IP. What's the best way to pass the IP using django-registration?

A: 

I also used the code from the tutorial you linked, in my case to add reCaptcha to the django comments app.

You need something like initial={'captcha': request.META['REMOTE_ADDR']} at the point where your RecaptchaRegistrationForm gets instantiated.

Unfortunately this is buried in the registration/views.py register method.

You need to do something like copy and paste their code into a view method of your own and edit it. Then you need a urls.py for your customised backend that looks like the one in registration/backends/default/ but points to your new register view in place of theirs.

Anentropic