Commit 5fb0e80c authored by Will LaShell's avatar Will LaShell
Browse files

Merge branch 'release/0.0.2'

parents 77da3d07 c1058b09
Loading
Loading
Loading
Loading

AUTHORS

0 → 100644
+2 −0
Original line number Diff line number Diff line
Joey Wilhelm <tarkatronic@gmail.com>
Will LaShell <wlashell@lyrical.net>
 No newline at end of file

MANIFEST.in

0 → 100644
+5 −0
Original line number Diff line number Diff line
include AUTHORS
include README.md
include README.rst
include VERSION
prune build
 No newline at end of file

README.rst

0 → 100644
+78 −0
Original line number Diff line number Diff line
django-botscout
===============

This provides an easy hook into the Botscout system for Django forms

Available Settings
------------------

.. code:: python

    # All settings are optional. They are displayed here with their defaults
    BOTSCOUT_API_KEY = None
    BOTSCOUT_API_URL = 'http://botscout.com/test/'
    BOTSCOUT_CACHE_TIMEOUT = 1800
    BOTSCOUT_NETWORK_TIMEOUT = 5

Additionally, you can set the following variables on individual forms to
alter their behavior:

.. code:: python

    BOTSCOUT_NAME_FIELD = 'name'
    BOTSCOUT_EMAIL_FIELD = 'email'
    BOTSCOUT_ERROR_MESSAGE = 'This request was matched in the BotScout database'

Basic Usage
-----------

In forms.py:

.. code:: python

    from botscout import BotScoutForm
    from django import forms


    class ContactForm(BotScoutForm, forms.Form):
        name = forms.CharField('Name')
        email = forms.EmailField('Email')

In views.py:

.. code:: python

    from .forms import ContactForm


    def contact(request):
        if request.method == 'POST':
            form = ContactForm(request=request, data=request.POST)
            if form.is_valid():
                ...
        else:
            form = ContactForm(request=request)
        ...

Advanced Usage
--------------

.. code:: python

    from botscout import BotScoutForm
    from django import forms
    from django.db import models


    class Person(models.Model):
        full_name = models.CharField('Full name', max_length=255)
        email_address = models.EmailField('Email')


    class MyForm(BotScoutForm, forms.ModelForm):
        BOTSCOUT_NAME_FIELD = 'full_name'
        BOTSCOUT_EMAIL_FIELD = 'email_address'
        BOTSCOUT_ERROR_MESSAGE = 'GO AWAY SPAM BOT!'

        class Meta:
            model = Person

VERSION

0 → 100644
+1 −0
Original line number Diff line number Diff line
0.0.2
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -8,9 +8,9 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
    name='django-botscout',
    version='0.0.1',
    author='Joey Wilhelm',
    author_email='tarkatronic@gmail.com',
    version='0.0.2',
    author='Joey Wilhelm, Will LaShell',
    author_email='tarkatronic@gmail.com, wlashell@lyrical.net',
    license='License :: OSI Approved',
    long_description=README,
    url='http://labs.lyrical.net/lyrical/django-botscout',