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 trialMike Nedelko
8,991 PointsClean a field task doesn't accept my solution
Hi Teamtreehouse
The 'clean a field' task doesn't accept my solution. It asks me to ensure that the honeypot doesn't have a length, which I do. Any suggestions?
def clean_honeypot(self): honeypot = self.cleaned_data['honeypot'] if len(honeypot): raise forms.validationError("Hooneypot should be left empty. 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("Hooneypot should be left empty. Bad bot!")
return honeypot
1 Answer
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsYou need a capital V in ValidationError
Mike Nedelko
8,991 PointsMike Nedelko
8,991 PointsThank you Brendan!