|pattern||(DB) null||(Form) blank||meaning|
|①||False||False||This field is required when submitting from a form, and the value stored in the database must not be empty|
|②||True||True||This field is not required when submitting from a form, it doesn't have to be in the value stored in the database.|
|③||False||True||This field is not required when submitting from a form, but the value stored in the database must not be empty.|
|④||True||False||This field must be entered when filling out the form, but the database value can be empty.|
- ① and ② is ordinary usage
- ③ is for str field.
- string values such as CharField and TextField, empty values are stored as empty strings instead of null.
- For this reason, only
blank = Truecan be specified for fields that handle character strings.
- It means We want to store
- ④ is weird.
- since There is a something values definitely from Form, DB never be going to be null.