Skip to content

jordij/wagtailsweetcaptcha

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

IMPORTANT MALWARE ISSUE: https://blog.sucuri.net/2015/06/sweetcaptcha-service-used-to-distribute-adware.html

Wagtail SweetCaptcha

Wagtail forms SweetCaptcha form field/widget integration app.

wagtailsweetcaptcha provides a an easy wayto integrate the django-sweetcaptcha field when using the Wagtail formbuilder.

Installation

  1. Install or add wagtailsweetcaptcha to your Python path.
  2. Add wagtailsweetcaptcha to your INSTALLED_APPS setting.
  3. Config django-sweetcaptcha as explained in here.

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

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.

About

A simple sweetcaptcha field for Wagtail Form Pages.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages