Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/springload/wagtail-django-recaptcha
A simple recaptcha field for Wagtail Form Pages
https://github.com/springload/wagtail-django-recaptcha
captcha recaptcha wagtail
Last synced: about 1 month ago
JSON representation
A simple recaptcha field for Wagtail Form Pages
- Host: GitHub
- URL: https://github.com/springload/wagtail-django-recaptcha
- Owner: springload
- License: mit
- Created: 2015-10-12T21:59:29.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T03:58:49.000Z (4 months ago)
- Last Synced: 2024-11-13T16:11:44.963Z (2 months ago)
- Topics: captcha, recaptcha, wagtail
- Language: Python
- Homepage: https://pypi.python.org/pypi/wagtail-django-recaptcha/
- Size: 59.6 KB
- Stars: 56
- Watchers: 19
- Forks: 21
- Open Issues: 13
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
- awesome-wagtail - Wagtail ReCaptcha - wagtail-django-captcha provides an easy way to integrate the [django-recaptcha](https://github.com/praekelt/django-recaptcha) field when using the Wagtail formbuilder. (Apps / Forms)
README
.. image:: https://travis-ci.org/springload/wagtail-django-recaptcha.svg?branch=master
:target: https://travis-ci.org/springload/wagtail-django-recaptcha
.. image:: https://img.shields.io/pypi/v/wagtail-django-recaptcha.svg
:target: https://pypi.python.org/pypi/wagtail-django-recaptcha
.. image:: https://codeclimate.com/github/springload/wagtail-django-recaptcha/badges/gpa.svg
:target: https://codeclimate.com/github/springload/wagtail-django-recaptcha
.. image:: https://coveralls.io/repos/github/springload/wagtail-django-recaptcha/badge.svg?branch=master
:target: https://coveralls.io/github/springload/wagtail-django-recaptcha?branch=masterWagtail 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.
Installation
------------#. Install wagtailcaptcha via pip ``pip install wagtail-django-recaptcha`` or add ``wagtailcaptcha`` to your Python path.
#. Add ``wagtailcaptcha`` to your ``INSTALLED_APPS`` setting.
#. Config django-recaptcha as explained in `here `_.
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.contrib.forms.models import AbstractFormField
from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.fields import RichTextFieldfrom 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.
.. code-block:: python
from wagtailcaptcha.forms import WagtailCaptchaFormBuilder
from wagtailcaptcha.models import WagtailCaptchaFormclass 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``
.. code:: sh
git clone [email protected]:springload/wagtail-django-recaptcha.git
cd wagtail-django-recaptcha/
virtualenv .venv
source ./.venv/bin/activate
make initCommands
~~~~~~~~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!.. _Semantic Versioning: http://semver.org/spec/v2.0.0.html
.. _changelog: https://github.com/springload/wagtail-django-recaptcha/blob/master/CHANGELOG.rst