Using and Creating Validators3:38 with Kenneth Love
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