My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads

Django Simple Captcha

About

Django Simple Captcha is an extremely simple, yet highly customizable Django application to add captcha images to any Django form.

Usage

Sample view:

from django import forms
from captcha.fields import CaptchaField
from django.shortcuts import render_to_response

class CaptchaTestForm(forms.Form):
    myfield = AnyOtherField()
    captcha = CaptchaField()

"""
# or, as a ModelForm:
class CaptchaTestModelForm(forms.ModelForm):
    captcha = CaptchaField()
    class Meta:
        model = MyModel
"""

def home(request):
    if request.POST:
        form = CaptchaTestForm(request.POST)

        # Validate the form: the captcha field will automatically 
        # check the input
        if form.is_valid():
            human = True
    else:
        form = CaptchaTestForm()

    return render_to_response('base.html',locals())

Features

  • Very simple to setup and deploy, yet very configurable
  • Can use custom challenges (e.g. random chars, simple maths, dictionary word, ...)
  • Custom generators, noise and filter functions alter the look of the generated image
  • Supports text-to-speech audio output of the challenge text, for improved accessibility

Requirements

Installation

  1. Download the 'captcha' application and put it anywhere in your Python path (or using setuptools: sudo easy_install django-simple-captcha)
  2. Add 'captcha' to the INSTALLED_APPS in your settings.py
  3. Run manage.py syncdb to create the required database tables
  4. Add an entry to your urls.py:
  5. urlpatterns += patterns('',
        url(r'^captcha/', include('captcha.urls')),
    )

Configuration

See CaptchaConfiguration for details on available configuration settings.

Generators

See CaptchaGenerators for a list of available challenge generator functions.

Powered by Google Project Hosting