Skip to main content

Extendable contact form plugin for Django CMS with spam protection and i18n

Project description

Contact form plugin for Django CMS with spam protection and i18n.

The message entered by the web user is turned into an email which is sent to the email address configured for the specific plugin instance.

Spam protection is provided by either ReCAPTCHA (free) or Akismet (free for personal use). Visit the respective website to obtain the keys required to activate the protection method of your choice.

Dependencies

Python Libs

If you decide to use the ReCAPTCHA spam protection method you need to install the python library recaptcha-client (package python-recaptcha in Debian).

If you use Akismet for spam protection akismet is needed. You also need to set your domain url in django admin in the section “sites”.

For Python version <2.7, importlib has to be installed since importlib is in the standard library in Python 2.7, but is a third-party package for older versions.

All libraries can be installed by pip or easy_install.

It is recommended but not required to use South. Again it can be easily installed by pip or easy_install.

Installation

Download

From PyPI

You can simply type into a terminal pip install cmsplugin-contact or easy_install cmsplugin-contact.

Manually

You can download a zip archive of the latest development version from GitHub. Unzip the file you downloaded. Then go in your terminal and cd into the unpacked folder. Then type python setup.py install in your terminal.

Setup

Put 'cmsplugin_contact' in your INSTALLED_APPS section in settings.py. Don’t forget to syncdb your database or migrate if you’re using South.

Put 'cmsplugin_contact.middleware.ForceResponseMiddleware' in your MIDDLEWARE_CLASSES section in settings.py.

Settings

DEFAULT_FROM_EMAIL

The email address that is used to send the message is picked up from DEFAULT_FROM_EMAIL Django setting. Additionally, the Reply-To: header is set to the user-supplied email address.

Sending the message using the user-supplied address to set From: header of the email is currently not supported. This is because many servers will reject emails that use From: addresses not registered with that server. Some servers may also strip the Reply-To: header. For this, the user-supplied email address is also added to the body of the message.

RECAPTCHA_PUBLIC_KEY and RECAPTCHA_PRIVATE_KEY

If you don’t want to enter the ReCATPCHA keys in the admin interface you can provide them through these settings.

AKISMET_API_KEY

The same as for ReCAPTCHA goes fo Akismet.

CMSPLUGIN_CONTACT_FORMS

Default:

(
    ('cmsplugin_contact.forms.ContactForm', _('default')),
)

You can use your custom ContactForm, just add a new tuple with the class path and name pretty name to show for your user.

If you want to steal using the default ContactForm, do like this in your settings:

(
    ('cmsplugin_contact.forms.ContactForm', _('default')),
    ('my_app.forms.MyContactForm', _('My form')),
)

In your custom form, you can set what template you want to use, like this:

class MyContactForm(Form):
    ...
    template = 'path/to/my_contact_template.html'

Editors

The default editor is WYMEditor like in Django CMS. The plugin respects the USE_TINYMCE setting of Django CMS. Please see Django CMS docs for more information on how to use TinyMCE. If you have the package 'djangocms_text_ckeditor' in your INSTALLES_APPS CKEditor is used.

Extending

See examples/cmsplugin_custom_contact how to subclass cmsplugin_contact and add custom fields into it. You can override properties of the subclassed ContactPlugin and use your own templates and classes.

Signals

Email sent

After the contact email has been sent a signal is fired. You can use it like this:

from django.dispatch import receiver
from cmsplugin_contact.cms_plugins import email_sent


@receiver(email_sent)
def handle_signal(sender, **kwargs):
    print kwargs['data']

Project details


Download files

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

Source Distribution

cmsplugin-contact-1.1.1.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

cmsplugin_contact-1.1.1-py2.7.egg (71.2 kB view details)

Uploaded Source

File details

Details for the file cmsplugin-contact-1.1.1.tar.gz.

File metadata

File hashes

Hashes for cmsplugin-contact-1.1.1.tar.gz
Algorithm Hash digest
SHA256 50af3117696b316a4031daffdcdbddeaf7d6446367227d4c7e490dcf61f53c25
MD5 75b2f5b924f3cbbda84386ff61512db8
BLAKE2b-256 de52bd5b5defe7b3ec75a7bdfc3f2b92d116f33dc96afbcf1b36c8a65ec59786

See more details on using hashes here.

File details

Details for the file cmsplugin_contact-1.1.1-py2.7.egg.

File metadata

File hashes

Hashes for cmsplugin_contact-1.1.1-py2.7.egg
Algorithm Hash digest
SHA256 54525d9e7bba7eb94d95fece9cfad38270a34e4a21750fd25930b4185139d5a9
MD5 7665cf9be93785eb6109595c8c2f37a4
BLAKE2b-256 8a2200e2066e6b710c49f2ef683cd3782c163567bdd857be5b3ab9619e4eeb7a

See more details on using hashes here.

Supported by

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