#22145 closed Cleanup/optimization (fixed)
Clarify documentation on Field.blank and Field.null options
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
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.)
For reference:
Attachments (1)
Change History (5)
comment:1 by , 11 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
Version: | 1.6 → master |
by , 11 years ago
Attachment: | 22145.patch added |
---|
Clarify documentation on Field.blank and Field.null options
comment:2 by , 11 years ago
Has patch: | set |
---|
Added patch 22145.patch and created a pull request for this ticket
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I agree that this could be improved. There's the additional issue in that we say:
followed by:
which repeats itself, but in an inconsistent way!