Quick start

These are the basic steps for using djangospam. You can get more info on the cited modules and at djangospam.settings.

Fake form without middleware

You may also use the fake form without the cookie middleware. This will not block access from known spam bots. In order to do this, include djangospam in your installed modules (at settings.py) and insert the following code in your template, before the true form:

{% include 'djangospam/form.html' %}

You may also define a spam_uri context variable with the fake formulary destination URI. If no URI is defined, the form will be posted at the same address of the page in which the form has been placed (it will be used a <form method-“post” action-“”>...</form> code). The destination address must accept POST requests and should not change the database.

You may customize the fake formulary by copying it’s template to template/djangospam at your application’s directory and editing it.

Akismet

New in version 0.2.0.

djangospam.akismet.moderator defines an Akismet-based comment moderator. Besides including djangospam in your installed modules (at settings.py), you should insert the following code to your models file:

from djangospam.akismet import moderator as akismet

class MyModel(...):
    ...

try:
    akismet.register(MyModel)
except akismet.AlreadyModerated:
    pass

Warning

Since version 0.4.0, the Akismet moderator has been turned a separate subpackage. Code using it must be rewritten as follows:

from djangospam import akismet

must be changed to:

from djangospam.akismet import moderator as akismet

Using from djangospam import akismet is now deprecated and won’t be available from 1.0.0 on.

You also must define the variables below at settings.py:

AKISMET_BLOG
Your home page URL, including http://
AKISMET_KEY
Your application key at akismet.com
AKISMET_USERAGENT
Your application name
AKISMET_USERAGENT_VERSION
Your application version