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
ANGEL SERRANO PEREZ9,855 Points
I dont know how to check capitalization and how to check if a part of a text is inside of another text
from django import forms
from django.core import validators
if '@teamtreehouse.com' in value:
raise forms.ValidationError('no tree')
email = forms.EmailField(validators=[not_treehouse])
link = forms.URLField()
honeypot = forms.CharField(widget=forms.HiddenInput,required=False)
honey = self.cleaned_data['honeypot']
raise forms.ValidationError('Bad robot!')
Steven Parker228,991 Points
Remember, you're not just checking if it's inside, you want to check if it is at the end. And you don't necessarily have to check capitalization if you can somehow be sure the case is what you want.
Python strings have a number of handy built-in methods. One of them is .endswith(), which checks to see if the string ends with another string. And of course, you can always change a string to lower case with the .lower() method. And, you can chain methods together if you want to do more than one of them to the same string.
I'm betting with these hints you can figure it out.