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 trialmarcolamoon
16,915 PointsHelp!! not getting it
Alright, now that we have the validator, we need to use it!
Add the not_treehouse validator to LeadShareForm's email field. Remember, validators is an iterable.
from django import forms
def not_treehouse(value):
if value.lower().endswith('@teamtreehouse.com'):
raise forms.ValidationError('Just come talk to me')
class LeadShareForm(forms.Form):
email = forms.EmailField(validators=[not_treehouse, non-@teamtreehouse])
email2 = forms.EmailField(label="Email again", validators=[not_treehouse, non-@teamtreehouse])
link = forms.URLField()
honeypot = forms.CharField(widget=forms.HiddenInput, required=False)
2 Answers
Hasan Ahmad
6,727 PointsFirstly, the challenge is asking you to only set the validator on the email attribute (not email2). Secondly, you are adding an extra argument in the validators argument. All you have to do is state the function name and thats it.
Carson Alexander
Python Web Development Techdegree Graduate 12,172 Pointsvalidators=[not_treehouse]