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

Katelyn Polahar
Katelyn Polahar
2,691 Points

Why do I keep getting a plain "Try again!" error on my clean_honeypot code challenge?

I have double checked for typos, and the code I used matches up with the code from the challenge. Am I missing something simple here?

from django import forms

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

    def clean_honeypot(self):
        honeypot = self.cleaned_data['honeypot']
        if len(honeypot):
            raise forms.ValidationError("*angry beeping noises*")
        return honeypot

2 Answers

Katelyn Polahar
Katelyn Polahar
2,691 Points

Ok, I just used the exact same code that has been getting an error for the last ten minutes (aka, exactly what's above) and passed both challenges, when before it was passing the first only. I don't know what was wrong hahaha

Cindy Lea
Cindy Lea
Courses Plus Student 6,497 Points

I entered your code for task1 & it works. If you are using this code for task2 then it will get an error as you need to add the rest of the code.