Skip to content

Commit cf07d5d

Browse files
authored
Merge pull request #42 from mjl/github
Add a field type "simple captcha", which automatically appears when …
2 parents 17af341 + 91567d9 commit cf07d5d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

README.rst

+10
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ field to the form designer. For everything else read through the
137137
django-recaptcha readme.
138138

139139

140+
Simple Captcha
141+
==============
142+
143+
To enable `django-simple-captcha <https://pypi.org/project/django-simple-captcha>`__ install
144+
`django-simple-captcha <https://pypi.org/project/django-simple-captcha>`__ and add
145+
``captcha`` to your ``INSTALLED_APPS`` as described in the documentation for
146+
``django-simple-captcha``. This will automatically add a "Simple Captcha"
147+
field to the form designer field types.
148+
149+
140150
Override field types
141151
====================
142152

form_designer/default_field_types.py

+16
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,19 @@ def require_choices(field):
102102
"field": partial(ReCaptchaField, widget=ReCaptchaV3),
103103
}
104104
)
105+
106+
107+
# Add django-simple-captcha field if available
108+
if apps.is_installed("captcha"): # pragma: no cover
109+
try:
110+
from captcha.fields import CaptchaField
111+
except ImportError:
112+
pass
113+
else:
114+
FIELD_TYPES.append(
115+
{
116+
"type": "simple captcha",
117+
"verbose_name": _("Simple CAPTCHA"),
118+
"field": CaptchaField
119+
}
120+
)

0 commit comments

Comments
 (0)