3

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?

Community
  • 1
  • 1
knuckfubuck
  • 969
  • 12
  • 25
  • Recaptcha is terrible. I'm not your free OCR slave. – Glenn Maynard Apr 26 '10 at 07:51
  • 1
    Opened this question in expectation of many thread-local based solutions that leak the request from the view. Yet there are no answers so far. I hope you don't end up doing something like that. – muhuk Apr 26 '10 at 09:07

1 Answers1

2

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
  • 32,188
  • 12
  • 99
  • 147