Opened 10 years ago

Closed 10 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 Tim Graham, 10 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Ola Sitarska, 10 years ago

Owner: changed from nobody to Ola Sitarska
Status: newassigned

comment:3 by Ola Sitarska, 10 years ago

Has patch: set

comment:4 by Collin Anderson, 10 years ago

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 by Baptiste Mispelon, 10 years ago

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

Resolution: fixed
Status: assignedclosed

In 69478859261bd1b3e82cc785fddb5e50e3e7645f:

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

Thanks Baptiste for the suggestion.

comment:7 by Tim Graham <timograham@…>, 10 years ago

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 by Baptiste Mispelon, 10 years ago

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 by Ola Sitarska, 10 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 Baptiste Mispelon, 10 years ago

Resolution: fixed
Status: newclosed

You're absolutely right, my mistake.

Thanks again.

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