Clarify documentation on Field.blank and Field.null options
|Reported by:||skipjack@…||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I find the documentation on the 'null' and 'blank' options for model fields do miss one point.
It is clearly stated that 'null' is for the database contraints and 'blank' is for the form validation (less clear though). While there are almost two paragraphs describing the correct setting for allowing empty string values (null=False, blank=True), it is not perfectly clear what setting is needed in order to deal with empty values for the remaining field types.
I missed one sentence like for (almost?) all other field types you need to set both blank and null to True in order to allow for empty values in your model.
Or am I missing something else? (I'm quite new to Django.)
Change History (5)
comment:1 Changed 2 years ago by EvilDMP
- Easy pickings set
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Uncategorized to Cleanup/optimization
- Version changed from 1.6 to master
Changed 2 years ago by out0fbound
comment:2 Changed 2 years ago by out0fbound
- Has patch set
comment:3 Changed 2 years ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from new to closed