Wagtail Simple Captcha
Wagtail forms with a Captcha form field/widget integration app. Wagtail Simple Captcha provides an easy way to integrate the django-simple-captcha field when using the Wagtail formbuilder.
This app is a modification of wagtail-django-recaptcha by Springload.
Check out Awesome Wagtail for more awesome packages and resources from the Wagtail community.
Installation
Install wagtailcaptcha via pip pip install wagtail-django-simple-captcha or add wagtailcaptcha to your Python path.
Add wagtailcaptcha and captcha to your INSTALLED_APPS setting.
Configure django-simple-captcha as explained in here.
Usage
Field
The quickest way to add a captcha field to a Wagtail Form Page is to inherit from the two options provided, WagtailCaptchaForm or WagtailCaptchaEmailForm. The first options inherits from AbstractForm while the seconds does it from AbstractEmailForm. Either way your page is going to display a captcha field at the end of the form.
Example:
from wagtail.contrib.forms.models import AbstractFormField
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.core.fields import RichTextField
# Or, if using Wagtail < 2.0
#from wagtail.wagtailforms.models import AbstractFormField
#from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
#from wagtail.wagtailcore.fields import RichTextField
from modelcluster.fields import ParentalKey
from wagtailcaptcha.models import WagtailCaptchaEmailForm
class SubmitFormField(AbstractFormField):
page = ParentalKey('SubmitFormPage', related_name='form_fields')
class SubmitFormPage(WagtailCaptchaEmailForm):
body = RichTextField(blank=True, help_text='Edit the content you want to see before the form.')
thank_you_text = RichTextField(blank=True, help_text='Set the message users will see after submitting the form.')
class Meta:
verbose_name = "Form submission page"
SubmitFormPage.content_panels = [
FieldPanel('title', classname="full title"),
FieldPanel('body', classname="full"),
FieldPanel('thank_you_text', classname="full"),
InlinePanel('form_fields', label="Form fields"),
MultiFieldPanel([
FieldPanel('to_address'),
FieldPanel('from_address'),
FieldPanel('subject'),
], "Email notification")
]
The captcha field can’t be added from the admin UI but will appear in your frontend as the last of the form fields.
If you need to customize the behavior of the form builder, make sure to inherit from wagtailcaptcha.forms.WagtailCaptchaFormBuilder instead of Wagtail’s default form builder, then declare it as usual on the page model:
from wagtailcaptcha.forms import WagtailCaptchaFormBuilder
from wagtailcaptcha.models import WagtailCaptchaForm
class CustomFormBuilder(WagtailCaptchaFormBuilder):
# Some custom behavior...
class FormPage(WagtailCaptchaForm):
form_builder = CustomFormBuilder
# The rest of the page definition as usual...
For a more thorough example, Made with Wagtail (github.com/springload/madewithwagtail) is an example of an open-source site using the module in which this app is based from.
Development
Installation
Requirements: virtualenv, pyenv, twine
git clone git@github.com:acarasimon96/wagtail-django-simple-captcha.git
cd wagtail-django-simple-captcha/
virtualenv .venv
source ./.venv/bin/activate
make init
Commands
Use make help to get a list of commands.
Copyright
© 2020 Timothy Bautista. Original code © 2016 Springload. Licensed under MIT License
Metadata
Release files for wagtail-django-simple-captcha 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| wagtail-django-simple-captcha-1.0.tar.gz | 10.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wagtail_django_simple_captcha-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.0 kB
Release files / wagtail-django-simple-captcha-1.0.tar.gz
| Download URL | wagtail-django-simple-captcha-1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2f675ee506c8efa9b2ed53153653847ff46e324221f6cf0d59a47c5837055b3
|
|
BLAKE2b-256 checksum How to use checksums |
68d9c5a359cbdbe42dc7caab85c3fd3f8f00ff8fdd80ee1984aa408d74c58e27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10
|
Release files / wagtail_django_simple_captcha-1.0-py3-none-any.whl
| Download URL | wagtail_django_simple_captcha-1.0-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea8d5b14a6573a0db3352915b2bc6dd47d968f9462747276402368e08f46541e
|
|
BLAKE2b-256 checksum How to use checksums |
e3d20b7d7b09e65b550df24a4d942b0854161926e0c507e738c7e26b0618de66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10
|
Security for wagtail-django-simple-captcha 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.