Skip to content

regulusweb/wagtail-contact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Contact form helpers for Wagtail

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages