Skip to main content

A simple recaptcha field for Wagtail Form Pages.

Project description

Wagtail ReCaptcha

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.


  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. Config django-recaptcha as explained in here.



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.


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 WagtailCaptchaForm

class SubmitFormField(AbstractFormField):
    page = ParentalKey('SubmitFormPage', related_name='form_fields')

class SubmitFormPage(WagtailCaptchaForm):
    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"
        description = "Page with the form to submit"

SubmitFormPage.content_panels = [
    FieldPanel('title', classname="full title"),
    FieldPanel('body', classname="full"),
    FieldPanel('thank_you_text', classname="full"),
    InlinePanel(SubmitFormPage, 'form_fields', label="Form fields"),
    ], "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 ( is an example of an open-source site using this module.



Requirements: virtualenv, pyenv, twine
git clone
cd wagtail-django-recaptcha/
virtualenv .venv
source ./.venv/bin/activate
make init


Use make help to get a list of commands.


  • Make a new branch for the release of the new version.
  • Update the CHANGELOG.
  • Update the version number in wagtailcaptcha/, 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!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
wagtail-django-recaptcha-1.0.tar.gz (11.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page