Opened 11 years ago
Closed 11 years ago
#23283 closed Cleanup/optimization (fixed)
Provide an explicit default for BooleanField used in the documentation
| Reported by: | Baptiste Mispelon | Owned by: | Ola Sitarska |
|---|---|---|---|
| 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
In Django 1.6, we changed the default value for a BooleaField from False to None.
Having a BooleanField without a default now results in warnings when running the validate/check command.
However, our documentation uses some BooleaField in a few examples (see [1] for example) but they don't have a default value.
I propose that all usages of BooleanField in our documentation provide an explicit default (False most likely) so that running the code doesn't raise any warnings.
[1] https://docs.djangoproject.com/en/dev/topics/db/models/#multi-table-inheritance
Change History (10)
comment:1 by , 11 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 11 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 11 years ago
| Has patch: | set |
|---|
comment:4 by , 11 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:5 by , 11 years ago
| Patch needs improvement: | set |
|---|---|
| Triage Stage: | Ready for checkin → Accepted |
The PR looks good but I found more instances of BooleanField usage (found with git grep "BooleanField(" docs):
- docs/ref/contrib/formtools/form-wizard.txt
- docs/ref/forms/validation.txt
- docs/topics/forms/index.txt
Would you mind fixing those too?
Thanks!
comment:6 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:8 by , 11 years ago
| Has patch: | unset |
|---|---|
| Patch needs improvement: | unset |
| Resolution: | fixed |
| Status: | closed → new |
Oops, looks like I was a bit too slow on the review.
I still think we should fix the remaining 3 (see comment 5) so I'll reopen this ticket.
comment:9 by , 11 years ago
| Has patch: | set |
|---|
I left them on purpose - these 3 remaining were in forms and I wasn't sure if they're raising the same warnings :)
Here is a pull request with remaining three BooleanFields: https://github.com/django/django/pull/3062
comment:10 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
You're absolutely right, my mistake.
Thanks again.
Feel free to link to the pull request https://github.com/django/django/pull/3061. It looks good to me.