What is the difference between null=True and blank=True in django data model?


For example, when adding database field, there will be such a field.models.CharField(null=True, blank=True)Herenull=TrueAndblank=TrueOn behalf of What?

  • NullFor databases, ifnull=TrueA that indicates that this field of the database can be empty.

  • BlankFor forms, ifblank=True, said your form can not fill in the field, such asAdminAdded under interfaceModelA record. The intuitive view is that the field is not bold