BooleanField should not override 'blank' if choices are specified
|Reported by:||jonash||Owned by:||tushar|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||jonas-django@…, tushar747@…||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
BooleanField currently allows settings 'choices'. It also always overrides 'blank'. This stems from the fact that in HTML, a blank value means False, and any (?) non-blank value means True for check boxes.
Now if you override 'choices', things change in terms of HTML, since now True and False are represented by "True" and "False" in the select box. This also makes it possible to supply a null/blank value (which would have meant False in the checkbox case).
BooleanField should either handle this fact gracefully, for instance by only overriding 'blank' if 'choices' is not given and then interpreting "True" and "False" as True and False. Or it should disallow overriding 'choices' entirely.
Change History (22)
comment:1 Changed 8 months ago by tushar
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:6 Changed 8 months ago by tushar
- Cc tushar747@… added
comment:7 Changed 8 months ago by timo
- Summary changed from BooleanField should either forbid setting 'choices' or not override 'blank' to BooleanField should not override 'blank' if choices are specified
- Triage Stage changed from Unreviewed to Accepted
comment:9 Changed 8 months ago by tushar
- Owner changed from nobody to tushar
- Status changed from new to assigned