From e51dc41c0872e8c2a0edc4cac535d68131deaf36 Mon Sep 17 00:00:00 2001 From: Dan Swain Date: Thu, 16 Nov 2023 18:11:03 -0500 Subject: [PATCH 1/4] Import from django_recaptcha instead of captcha --- tests/test_forms.py | 4 ++-- wagtailcaptcha/forms.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_forms.py b/tests/test_forms.py index e1c9eef..ab88c40 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -1,6 +1,6 @@ from __future__ import absolute_import, unicode_literals -from captcha.fields import ReCaptchaField +from django_recaptcha.fields import ReCaptchaField from django.test import TestCase from home.models import TestCaptchaEmailFormField @@ -26,7 +26,7 @@ def test_captcha_field_is_present(self): self.assertIsInstance( generated_fields[WagtailCaptchaFormBuilder.CAPTCHA_FIELD_NAME], ReCaptchaField, - msg="Captcha field should be an instance of `captcha.fields.ReCaptchaField`.", + msg="Captcha field should be an instance of `django_recaptcha.fields.ReCaptchaField`.", ) def test_user_defined_fields_are_present(self): diff --git a/wagtailcaptcha/forms.py b/wagtailcaptcha/forms.py index eb7660c..8025f19 100644 --- a/wagtailcaptcha/forms.py +++ b/wagtailcaptcha/forms.py @@ -1,6 +1,6 @@ from __future__ import absolute_import, unicode_literals -from captcha.fields import ReCaptchaField +from django_captcha.fields import ReCaptchaField from wagtail.contrib.forms.forms import FormBuilder From 3c38a0a9fd1750b327f64e96c08d9394e8b7a40e Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Fri, 17 Nov 2023 17:38:00 +0000 Subject: [PATCH 2/4] Require django-recaptcha>=4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9363f95..7e412aa 100644 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ], - install_requires=["django-recaptcha"], + install_requires=["django-recaptcha>=4"], extras_require={ "testing": testing_extras, "docs": documentation_extras, From 636f3f3404d8b2d06cbadbab336796f5a778784e Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Thu, 23 Nov 2023 12:15:02 +0800 Subject: [PATCH 3/4] Linting, replace captcha instance in settings.py --- setup.py | 2 +- tests/test_forms.py | 4 ++-- tests/testapp/testapp/settings.py | 2 +- wagtailcaptcha/forms.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 9363f95..7e412aa 100644 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ], - install_requires=["django-recaptcha"], + install_requires=["django-recaptcha>=4"], extras_require={ "testing": testing_extras, "docs": documentation_extras, diff --git a/tests/test_forms.py b/tests/test_forms.py index e1c9eef..44f4ee8 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -1,7 +1,7 @@ from __future__ import absolute_import, unicode_literals -from captcha.fields import ReCaptchaField from django.test import TestCase +from django_recaptcha.fields import ReCaptchaField from home.models import TestCaptchaEmailFormField from wagtailcaptcha.forms import WagtailCaptchaFormBuilder @@ -26,7 +26,7 @@ def test_captcha_field_is_present(self): self.assertIsInstance( generated_fields[WagtailCaptchaFormBuilder.CAPTCHA_FIELD_NAME], ReCaptchaField, - msg="Captcha field should be an instance of `captcha.fields.ReCaptchaField`.", + msg="Captcha field should be an instance of `django_recaptcha.fields.ReCaptchaField`.", ) def test_user_defined_fields_are_present(self): diff --git a/tests/testapp/testapp/settings.py b/tests/testapp/testapp/settings.py index 1ee3374..c8766ea 100644 --- a/tests/testapp/testapp/settings.py +++ b/tests/testapp/testapp/settings.py @@ -128,7 +128,7 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" # Silence some errors -SILENCED_SYSTEM_CHECKS = ["captcha.recaptcha_test_key_error"] +SILENCED_SYSTEM_CHECKS = ["django_recaptcha.recaptcha_test_key_error"] DEFAULT_AUTO_FIELD = "django.db.models.AutoField" try: diff --git a/wagtailcaptcha/forms.py b/wagtailcaptcha/forms.py index eb7660c..cfa6d52 100644 --- a/wagtailcaptcha/forms.py +++ b/wagtailcaptcha/forms.py @@ -1,6 +1,6 @@ from __future__ import absolute_import, unicode_literals -from captcha.fields import ReCaptchaField +from django_recaptcha.fields import ReCaptchaField from wagtail.contrib.forms.forms import FormBuilder From 3010ab97ac3256382447fcd1df5cba31c60efba4 Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Thu, 23 Nov 2023 09:08:00 +0000 Subject: [PATCH 4/4] Correct import --- wagtailcaptcha/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wagtailcaptcha/forms.py b/wagtailcaptcha/forms.py index 8025f19..cfa6d52 100644 --- a/wagtailcaptcha/forms.py +++ b/wagtailcaptcha/forms.py @@ -1,6 +1,6 @@ from __future__ import absolute_import, unicode_literals -from django_captcha.fields import ReCaptchaField +from django_recaptcha.fields import ReCaptchaField from wagtail.contrib.forms.forms import FormBuilder