https://github.com/cvan/django-potato-captcha
A very simple, clever Django captcha application
https://github.com/cvan/django-potato-captcha
Last synced: 4 months ago
JSON representation
A very simple, clever Django captcha application
- Host: GitHub
- URL: https://github.com/cvan/django-potato-captcha
- Owner: cvan
- License: bsd-2-clause
- Created: 2013-04-14T02:17:06.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T17:46:17.000Z (about 5 years ago)
- Last Synced: 2025-04-02T03:38:57.335Z (about 1 year ago)
- Language: Python
- Size: 12.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
=====================
django-potato-captcha
=====================
A very simple, clever Django captcha application. This provides a wrapper
around ``django.forms.Form`` and ``django.forms.ModelForm``, which creates
two honeypot fields:
1. ``tuber``: This field should always be blank.
2. ``sprout``: This field's value should always be ``potato``, which should
get set by JavaScript in your template.
Usage
-----
In your ``forms.py``::
from django.forms import forms
from django_potato_captcha.forms import (PotatoCaptchaForm,
PotatoCaptchaModelForm)
class FrenchFriedForm(PotatoCaptchaForm):
text = forms.CharField()
class FrenchFriedModelForm(PotatoCaptchaForm):
text = forms.CharField()
class Meta:
model = Fry
In your template::
.potato-captcha {
left: -9999px;
opacity: 0;
position: absolute;
visibility: hidden;
}
{% csrf_token %}
{{ form.tuber }}
{{ form.sprout }}
{{ _('Submit') }}
document.querySelector('input[name=sprout]').value = 'potato';
Installation
------------
Make sure you have ``homebrew`` and ``virtualenv``/``virtualenvwrapper``
installed::
curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | $SHELL
source ~/.profile
Then install::
mkvirtualenv --no-site-packages potato
workon potato
python setup.py install
Or install directly from PyPi::
pip install django_potato_captcha
Testing
-------
Simply run this command::
nosetests