Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (16 sloc) 0.668 kb
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from widgets import HoneypotWidget
class HoneypotField(forms.BooleanField):
def __init__(self, *args, **kwargs):
super(HoneypotField, self).__init__(
widget = HoneypotWidget,
required = False,
error_messages = { 'checked': _("Please don't check this box.") },
*args, **kwargs)
def clean(self, value):
val = super(HoneypotField, self).clean(value)
if val:
raise ValidationError(self.error_messages['checked'])
return val
Jump to Line
Something went wrong with that request. Please try again.