Opened 8 years ago

Closed 8 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 Changed 8 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by Ola Sitarska

Owner: changed from nobody to Ola Sitarska
Status: newassigned

comment:3 Changed 8 years ago by Ola Sitarska

Has patch: set

comment:4 Changed 8 years ago by Collin Anderson

Triage Stage: AcceptedReady for checkin

Feel free to link to the pull request https://github.com/django/django/pull/3061. It looks good to me.

comment:5 Changed 8 years ago by Baptiste Mispelon

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

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 Changed 8 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 69478859261bd1b3e82cc785fddb5e50e3e7645f:

Fixed #23283 -- Added default=False to BooleanField's in the docs.

Thanks Baptiste for the suggestion.

comment:7 Changed 8 years ago by Tim Graham <timograham@…>

In 0f44d9f9b153a25376e57060e849cddfaab9c350:

[1.7.x] Fixed #23283 -- Added default=False to BooleanField's in the docs.

Thanks Baptiste for the suggestion.

Backport of 6947885926 from master

comment:8 Changed 8 years ago by Baptiste Mispelon

Has patch: unset
Patch needs improvement: unset
Resolution: fixed
Status: closednew

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 Changed 8 years ago by Ola Sitarska

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 Changed 8 years ago by Baptiste Mispelon

Resolution: fixed
Status: newclosed

You're absolutely right, my mistake.

Thanks again.

Note: See TracTickets for help on using tickets.
Back to Top