Built-in Field Validation

Let’s learn about different built-in field validations.

Built-in Field Validations in Django models are the validations that are predefined in all Django fields. For example, IntegerField comes with built-in validation that it can only store integer values, and that it can only do so within a particular range. These validations are set in place so that invalid values are not submitted to the form. Django will show an error to let us know that an invalid value was submitted.

To understand the use of built-in validations, it’s best if we see them in action.

Modify the model

First, let’s modify our model a little bit. We added a count column in Access records.

Get hands-on with 1200+ tech skills courses.