Commits

Konrad Rymczak committed e8cd65e

Missing files

Comments (0)

Files changed (8)

+Copyright © 2012, Marc-Stefan Cassola
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright notice,
+       this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above copyright notice,
+       this list of conditions and the following disclaimer in the
+       documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+include README.rst
+include LICENSE
+recursive-include cmsplugin_contact/locale *.mo
+graft cmsplugin_contact/templates
+==============================
+Django CMS Contact Form Plugin
+==============================
+
+Contact form plugin for `Django CMS <http://www.django-cms.org/>`_ with spam protection and i18n.
+
+If you want to use ReCAPTCHA you have to get a Public and Private Key from http://www.google.com/recaptcha. You can get them for free.
+
+The Akismet spam protection method requires an Akismet API Key which is obtainable from http://akismet.com/ For private persons this is free, too.
+
+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".
+
+Both 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 zipped archive from http://github.com/maccesch/cmsplugin-contact/downloads.
+
+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.
+
+Settings
+========
+
+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.
+
+DEFAULT_FROM_EMAIL
+------------------
+
+This django setting is used to set the ``From`` header of the emails. The value you can enter in django admin only sets the ``Reply-To`` header.
+This is because many servers reject mails that claim to be ``From`` different email addresses than registered with the server.
+
+
+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.
Add a comment to this file

examples/cmsplugin_custom_contact/__init__.py

Empty file added.

examples/cmsplugin_custom_contact/cms_plugins.py

+from django.utils.translation import ugettext_lazy as _
+
+from cms.plugin_pool import plugin_pool
+
+from cmsplugin_contact.cms_plugins import ContactPlugin
+from models import CustomContact
+from forms import CustomContactForm
+
+class CustomContactPlugin(ContactPlugin):
+    name = _("Custom Contact Form")
+    
+    model = CustomContact
+    contact_form = CustomContactForm
+    
+    # We're using the original cmsplugin_contact templates here which
+    # works fine but requires that the original plugin is in INSTALLED_APPS.
+    render_template = "cmsplugin_contact/contact.html"
+    email_template = "cmsplugin_contact/email.txt"
+    
+    fieldsets = (
+        (None, {
+                'fields': ('site_email', 'email_label', 'custom_label',
+                           'subject_label', 'content_label', 'thanks',
+                           'submit'),
+        }),
+        (_('Spam Protection'), {
+                'fields': ('spam_protection_method', 'akismet_api_key',
+                           'recaptcha_public_key', 'recaptcha_private_key',
+                           'recaptcha_theme')
+        })
+    )
+
+plugin_pool.register_plugin(CustomContactPlugin)

examples/cmsplugin_custom_contact/forms.py

+from django import forms
+from cmsplugin_contact.forms import ContactForm
+
+class CustomContactForm(ContactForm):
+    custom = forms.CharField()

examples/cmsplugin_custom_contact/models.py

+from django.db import models
+from cmsplugin_contact.models import BaseContact
+from django.utils.translation import ugettext_lazy as _
+
+class CustomContact(BaseContact):
+    custom_label = models.CharField(
+        _('Custom sender label'),
+        default=_('Your custom value'), max_length=20)
+from setuptools import setup, find_packages
+
+setup(
+    name='cmsplugin-contact',
+    version='1.0.0',
+    description='Extendable contact form plugin for Django CMS with spam protection and i18n',
+    long_description=open('README.rst').read(),
+    author='Maccesch',
+    author_email='maccesch@gmail.com',
+    url='http://github.com/maccesch/cmsplugin-contact',
+    packages=find_packages(),
+    keywords='contact form django cms django-cms spam protection email',
+    classifiers=[
+        'Development Status :: 5 - Production/Stable',
+        'Environment :: Web Environment',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: BSD License',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python',
+        'Framework :: Django',
+    ],
+    include_package_data=True,
+    zip_safe=False,
+    install_requires=[],
+)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.