Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将django recaptcha添加到注册表时出现问题_Python_Django_Forms_Recaptcha - Fatal编程技术网

Python 将django recaptcha添加到注册表时出现问题

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

我在注册表格中添加django recaptcha时遇到问题。该表格是django注册表格的扩展。以下是我如何将其插入(仅显示相关代码):

URL.py:

*注册_custom.forms.py:*

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']