Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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?

myproject/forms.py
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
PLUS
Cindy Lea
Courses Plus Student 6,485 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.