Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.38 KB

README.md

File metadata and controls

36 lines (23 loc) · 1.38 KB

Provide a simple mixin which bakes a contact form(send emails on submit) into the inheriting classes, specifically Wagtail pages.

The mixin is an abstract Django model which has an enquiry_email field. This field is also added to the content_panels.

Install

pip install https://github.com/regulusweb/wagtail-contact/archive/master.zip

Be sure to add honeypot, crispy_forms, and wagtailcontact to INSTALLED_APPS in settings.py. The contact form uses django-honeypot to prevent automated form spam and django-crispy-forms to spice things up.

Note: The crispy helper has form_tag set to False to make it easy to render the honeypot field within the form.

Set the CRISPY_TEMPLATE_PACK in your settings. django-honeypot also requires a few settings to be declared in settings.py. See django-honeypot for more information.

Usage

The Wagtail page you want to add this functionality should extend wagtailcontact.mixins.ContactMixin.

When rendering the form in your page template be sure to add the honeypot field using the render_honeypot_field tag. Otherwise a HTTP BadRequest will explode when you try to submit the form without this.

Like so:

{% load honeypot %}

And then within the form include the honeypot field:

{% render_honeypot_field %}

Tests

You can either invoke python runtests.py, or python setup.py test