Skip to main content

A simple sweetcaptcha field for Wagtail Form Pages.

Project description

Wagtail SweetCaptcha
================
**Wagtail forms SweetCaptcha form field/widget integration app.**

wagtailsweetcaptcha provides a an easy wayto integrate the `django-sweetcaptcha <https://pypi.python.org/pypi/sweetcaptcha/>`_ field when using the Wagtail formbuilder.


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

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

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

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


Usage
-----

Field
~~~~~
The quickest way to add a sweetcaptcha field to a Wagtail Form Page is to inherit from the two options provided, ``SweetCaptchaForm`` or ``SweetCaptchaEmailForm``. The first options inherits from ``AbstractForm`` while the seconds does it from ``AbstractEmailForm``. Either way your page is going to display a sweetcaptcha 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 wagtailsweetcaptcha.models import SweetCaptchaEmailForm


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


class SubmitFormPage(SweetCaptchaEmailForm):
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 sweetcaptcha field can't be added from the admin UI but will appear in your frontend.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

wagtailsweetcaptcha-0.0.1-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file wagtailsweetcaptcha-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for wagtailsweetcaptcha-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f1b3fb3e25ed98882468920cf24d3c3c1be12c818d3976d6d44588d56d565cf8
MD5 96f99fb469a8be71fc4385d7a354dc19
BLAKE2b-256 f3e79ef7a37451540d0dd4e7ba44d82aa3b0e33d42bf3afb75d003381934c1b3

See more details on using hashes here.

Supported by

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