Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHamid Salehi
5,721 PointsValidationError problem, Can't get the right clean_honeypot function to work
what is wrong with this code? I can't figure it out
from django import forms
class LeadShareForm(forms.Form):
email = forms.EmailField()
link = forms.URLField()
honeypot = forms.CharField(required=False, widget=forms.HiddenInput, label="Leave Empty")
def clean_honeypot(self):
honeypot = self.cleaned_data['honeypot']
if len(honeypot):
raise forms.ValidationError("Bad bot!")
return honeypot
from django import forms
class LeadShareForm(forms.Form):
email = forms.EmailField()
link = forms.URLField()
honeypot = forms.CharField(required=False, widget=forms.HiddenInput, label="Leave Empty")
def clean_honeypot(self):
honeypot = self.cleaned_data['honeypot']
if len(honeypot):
raise forms.ValidationError("Bad bot!")
return honeypot
Modou Sawo
13,141 PointsModou Sawo
13,141 PointsI'm having the same problem. The suggestion message still goes through