Python 将django recaptcha添加到注册表时出现问题
我在注册表格中添加django recaptcha时遇到问题。该表格是django注册表格的扩展。以下是我如何将其插入(仅显示相关代码): URL.py: *注册_custom.forms.py:*Python 将django recaptcha添加到注册表时出现问题,python,django,forms,recaptcha,Python,Django,Forms,Recaptcha,我在注册表格中添加django recaptcha时遇到问题。该表格是django注册表格的扩展。以下是我如何将其插入(仅显示相关代码): URL.py: *注册_custom.forms.py:* from captcha.fields import ReCaptchaField class RegistrationFormUniqueEmail(RegistrationForm): """ Subclass of ``RegistrationForm`` which en
from captcha.fields import ReCaptchaField
class RegistrationFormUniqueEmail(RegistrationForm):
"""
Subclass of ``RegistrationForm`` which enforces uniqueness of
email addresses.
"""
# added recaptcha
captcha = ReCaptchaField()
def clean_email(self):
"""
Validate that the supplied email address is unique for the
site.
"""
if User.objects.filter(email__iexact=self.cleaned_data['email']):
raise forms.ValidationError(_("This email address is already in use. Please supply a different email address."))
return self.cleaned_data['email']
我已经检查了我的recaptcha密钥是否正确,它们是否正确,并且这些密钥是为我用来测试的域设置的
你能发现我错过了什么吗?谢谢。您是否已将recaptcha添加到已安装的应用程序中?确切的问题是什么?已将“验证码”添加到已安装的应用程序中;问题是表单上没有显示recaptcha。
from captcha.fields import ReCaptchaField
class RegistrationFormUniqueEmail(RegistrationForm):
"""
Subclass of ``RegistrationForm`` which enforces uniqueness of
email addresses.
"""
# added recaptcha
captcha = ReCaptchaField()
def clean_email(self):
"""
Validate that the supplied email address is unique for the
site.
"""
if User.objects.filter(email__iexact=self.cleaned_data['email']):
raise forms.ValidationError(_("This email address is already in use. Please supply a different email address."))
return self.cleaned_data['email']