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-django-captcha provides a an easy way to integrate the `django-recaptcha <https://github.com/praekelt/django-recaptcha>`_ field when using the Wagtail formbuilder.


Installation
------------

#. Install or add ``wagtailcaptcha`` to your Python path.

#. Add ``wagtailcaptcha`` to your ``INSTALLED_APPS`` setting.

#. Config django-recaptcha as explained in `here <https://github.com/praekelt/django-recaptcha>`_.


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

.. code-block:: python

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"),
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.

Project details


Download files

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

Source Distribution

wagtail-django-recaptcha-0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

wagtail_django_recaptcha-0.1-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wagtail-django-recaptcha-0.1.tar.gz.

File metadata

File hashes

Hashes for wagtail-django-recaptcha-0.1.tar.gz
Algorithm Hash digest
SHA256 0a8d72480b7e6dcc7938fb7bb2e2006a0117cf74a9e13f0c905836c513afd465
MD5 8b918ae34f224d88c3fbd1cbfe90bab5
BLAKE2b-256 6336cbd44b8d8bd34ddcf3046fe7b65c25a4fe1ff60bd903409bc9acc2567365

See more details on using hashes here.

File details

Details for the file wagtail_django_recaptcha-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_django_recaptcha-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fe442d3f015bdef4069f6702de02f31767343e4865bd1fe8ebc6597fde4d1ef9
MD5 8a438b026188eb8da48b46371a13788b
BLAKE2b-256 07147d0096f67af37245e1bbcedababee60204899bf79caa8e349a705dcf2a82

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page