Skip to main content

Wagtail ReCaptcha

PyPI PyPI downloads Build Status codecov License: MIT

Wagtail forms with a ReCaptcha form field/widget integration app. Wagtail ReCaptcha provides an easy way to integrate the django-recaptcha field when using the Wagtail formbuilder.

Check out Awesome Wagtail for more awesome packages and resources from the Wagtail community.

Compatibility

  • Django 5.2, 6.0
  • Wagtail 7.0 LTS, 7.3
  • Python 3.10, 3.11, 3.12, 3.13, 3.14

Installation

  1. Install wagtailcaptcha via pip pip install wagtail-django-recaptcha or add wagtailcaptcha to your Python path.
  2. Add wagtailcaptcha to your INSTALLED_APPS setting.
  3. Configure django-recaptcha as explained in the django recaptcha documentation.

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.panels import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.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 customise the behaviour 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 behaviour...


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 this module.

Development

Installation

Requirements: virtualenv, pyenv, twine

git clone git@github.com:wagtail-nest/wagtail-django-recaptcha.git
cd wagtail-django-recaptcha/
virtualenv .venv
source ./.venv/bin/activate

Commands

Use make help to get a list of commands.

Releases

  • Make a new branch for the release of the new version.
  • Update the CHANGELOG.
  • Update the version number in wagtailcaptcha/__init__.py, following semver.
  • Make a PR and squash merge it.
  • Back on master with the PR merged, use make publish (confirm, and enter your password).
  • Finally, go to GitHub and create a release and a tag for the new version.
  • Done!

Acknowledgements

Wagtail ReCaptcha was originally created by Springload. They kindly transferred the project to the Wagtail Nest community in December 2024.

Release files for wagtail-django-recaptcha 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-django-recaptcha 2.2.0
File Size Uploaded
wagtail_django_recaptcha-2.2.0.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-django-recaptcha 2.2.0
File Interpreter ABI Platform
wagtail_django_recaptcha-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 kB

Release files / wagtail_django_recaptcha-2.2.0.tar.gz

Download URL wagtail_django_recaptcha-2.2.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d7340ba346f365f475595b733c4f4ef380bd2e331261d5a5604b57baa3a7b786
BLAKE2b-256 checksum
How to use checksums
aebaca504c45123f07314a0cd83a03c5b3872c3e851e703f0a6ea92fbf6f2e10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 18, 2026.

Transparency log

Release files / wagtail_django_recaptcha-2.2.0-py3-none-any.whl

Download URL wagtail_django_recaptcha-2.2.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
094a59cbfd9f02d41e9fd0a294fc3e754e5b5fc5da01cc15a8e08007f3ad2f67
BLAKE2b-256 checksum
How to use checksums
856e51b0f5be85c42364b325ef623cbd7fbc038c10bc3d11fb75b6acfe09cc35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

2.1.1

1 release file

2.1

1 release file

1.0

1 release file

0.2

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page