Opened 18 years ago
Closed 18 years ago
#2516 closed enhancement (wontfix)
Add 'optional' argument to model fields as shortcut for "blank=True, null=True"
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have read http://www.b-list.org/weblog/2006/06/28/django-tips-difference-between-blank-and-null and can understand the logic behind having both the blank and null arguments, but the reasoning for this ("there are times when you need it") seems to be the exception and not the rule. Wouldn't it make sense to provide a keyword agrument 'optional' that, when true, shortcuts the otherwise confusing "blank=True, null=True" arguments?
I think this would make things eaiser to understand for newcomers who want optional fields while still providing the same flexability with.
No, we won't be adding this. First, it would create more than one way of expressing the same thing. Second, you don't always *need*
null=True
. For example, aCharField
should not havenull=True
, but anIntegerField
should.