Opened 23 months ago

Closed 23 months ago

Last modified 23 months 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 Changed 23 months ago by Alasdair Nicol <alasdair@…>

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to anonymous
  • Patch needs improvement unset
  • Status changed from new to assigned

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 Changed 23 months ago by alasdair

  • Owner changed from anonymous to alasdair

comment:3 Changed 23 months ago by alasdair

  • Has patch set

comment:4 Changed 23 months ago by russellm

  • Severity changed from Normal to Release blocker
  • Type changed from New feature to Cleanup/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 Changed 23 months ago by alasdair

  • Owner alasdair deleted
  • Status changed from assigned to new

comment:6 Changed 23 months ago by timo

  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted
  • Version set to 1.6-beta-1

Left comments on PR.

comment:7 Changed 23 months ago by alasdair

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

  • Owner set to Tim Graham <timograham@…>
  • Resolution set to fixed
  • Status changed from new to closed

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

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