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 trial

Python Django Forms Forms Clean a Field

Rui Barbosa
Rui Barbosa
19,432 Points

Problem in Custom Field Validation Challenge Task

So i came across with a problem at the last step of Task but i can't identify where is the error!

Can someone review the code for me and tell me where's the mistakeplease?

Thank you guys!

myproject/forms.py
from django import forms


class LeadShareForm(forms.Form):
    email = forms.EmailField()
    link = forms.URLField()
    honeypot = forms.CharField(widget=forms.HiddenInput, required=False)

        def clean_honeypot(self):
            honeypot = self.cleaned_data['honeypot']
            if len(honeypot):
                raise forms.ValidationError('Error')
            return honeypot

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

You are SO close. The clean_honeypot method is indented too far. Fixing this passes the challenge.

Post back if you need more help. Good Luck!!

Rui Barbosa
Rui Barbosa
19,432 Points

Oh, don't know how i missed that!

Thank you very much!!