Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20895 closed Cleanup/optimization (fixed)

Make check management command warn about BooleanFields without default value.

Reported by: Alasdair Nicol <alasdair@…> Owned by: Tim Graham <timograham@…>
Component: Core (Management commands) Version: 1.6-beta-1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

As suggested by Collin Anderson in the django-developers group:

The new ./manage check command is for helping people upgrade to a new version of django. https://docs.djangoproject.com/en/dev/ref/django-admin/#check

django1.6 changes models.BooleanField() to not default to False any more. This has already bitten me a few times. https://docs.djangoproject.com/en/dev/releases/1.6/#booleanfield-no-longer-defaults-to-false

Can we add a warning about BooleanFields without default values to the "check" command?

Change History (9)

comment:1 by Alasdair Nicol <alasdair@…>, 11 years ago

Owner: changed from nobody to anonymous
Status: newassigned

I've written a patch for this. I still have to write tests, then I will create a pull request.

https://github.com/alasdairnicol/django/tree/ticket_20895_check_boolean_field

comment:2 by alasdair, 11 years ago

Owner: changed from anonymous to alasdair

comment:3 by alasdair, 11 years ago

Has patch: set

comment:4 by Russell Keith-Magee, 11 years ago

Severity: NormalRelease blocker
Type: New featureCleanup/optimization

Marking this as a release blocker; it isn't technically a release blocker, but it's something that won't be much use if we don't land it before the release, so we should give it some focus ASAP. I'm also reclassifiying as a cleanup, rather than a new feature, because it's really just enhancing the attention on an existing change, using a facility that didn't exist at the time the change was committed.

comment:5 by alasdair, 11 years ago

Owner: alasdair removed
Status: assignednew

comment:6 by Tim Graham, 11 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted
Version: 1.6-beta-1

Left comments on PR.

comment:7 by alasdair, 11 years ago

Updated pull request following Tim's comments. Writing tests is complicated by the fact that many of the models in the tests have BooleanFields without default values. I'm not sure of the best way to proceed. I've left more details on the pull request.

https://github.com/django/django/pull/1466#issuecomment-22533957

comment:8 by Tim Graham <timograham@…>, 11 years ago

Owner: set to Tim Graham <timograham@…>
Resolution: fixed
Status: newclosed

In 22c6497f990fd12359b759a71abfcbf3f52b2d52:

Fixed #20895 -- Made check management command warn if a BooleanField does not have a default value

Thanks to Collin Anderson for the suggestion and Tim Graham for
reviewing the patch.

comment:9 by Tim Graham <timograham@…>, 11 years ago

In 919934602fd2767024126e094d33f0ad64947270:

[1.6.x] Fixed #20895 -- Made check management command warn if a BooleanField does not have a default value

Thanks to Collin Anderson for the suggestion and Tim Graham for
reviewing the patch.

Backport of 22c6497f99 from master

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