Django-registration and ReCaptcha integration - how to pass the user's IP
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?
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.
精彩评论