我尝试在我的注册表单中添加一个 recaptcha 字段并遵循 Marcos 指南:
http://www.marcofucci.com/tumblelog/26/jul/2009/integrating-recaptcha-with-django/
在我的注册应用程序中,我有一个文件“forms.py”,如下所示:
from recaptcha import fields as captcha_field
from registration.forms import RegistrationFormUniqueEmail
class RecaptchaRegistrationForm(RegistrationFormUniqueEmail):
recaptcha = captcha_field.ReCaptchaField()
和一个 urls.py,它被我的解决方案范围的 urls.py 包含在 /accounts 下:
from django.conf.urls.defaults import *
from registration.views import register
from forms import RecaptchaRegistrationForm
urlpatterns = patterns('users.views',
(r'^$', 'profile'),
url(r'^register/$', register, {'form_class': RecaptchaRegistrationForm}, name='registration_register'),
)
现在,当我转到 /accounts/register/ 时,我收到以下错误消息:
异常值:register() 至少需要 2 个非关键字参数(1 个给定)
我不知道为什么。