Heads up! To view this whole video, sign in with your Courses Plus account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Validators, whether custom or Django-provided, give us a great way to make sure the content of a field matches a condition we've set.
Did you notice my flip-flop in the video? Writing a custom validator is a great way to have reusable validation, so if I need to do something specific on a lot of fields, I definitely use a custom validator. In the example in this video, though, it just makes more sense to use Django's provided MaxLengthValidator
. Sorry if that was a bit confusing!
You need to sign up for Treehouse in order to download course files.
Sign up