﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30216	Document BooleanField is no longer blank=True in Django 2.1+	Ed Morley	David Vaz	"Hi!

In Django 2.1, as part of adding `null` support to `BooleanField`, the previously implicit/hardcoded `blank=True` of `BooleanField` was removed:
https://github.com/django/django/commit/5fa4f40f45fcdbb7e48489ed3039a314b5c961d0#diff-bf776a3b8e5dbfac2432015825ef8afeL995

In one of our projects, we had a model with a `BooleanField` defined like so:

{{{#!python
class PerformanceAlert(models.Model):
    id = models.AutoField(primary_key=True)
    # ...
    is_regression = models.BooleanField()
}}}

The REST API for that model uses django-rest-framework's `ModelSerializer`, which generates validation rules based on the model properties. 

In Django 2.0, the d-r-f API serializer's `repr()` is:

{{{#!python
PerformanceAlertSerializer():
    id = IntegerField(read_only=True)
    # ...
    is_regression = BooleanField(required=False)
}}}

But under Django 2.1 this changed to

{{{#!python
PerformanceAlertSerializer():
    id = IntegerField(read_only=True)
    # ...
    is_regression = BooleanField()
}}}


As such under Django 2.1 API calls that were previously successful then failed with `This field is required.`. (It turned out our API is using `PUT`s in places it should really be using `PATCH`.)

We were able to resolve the issue by adjusting `PerformanceAlertSerializer` such that it explicitly configures the field with `serializers.BooleanField(required=False)`, however it would be great to mention this ~breaking change in the Django 2.1 release notes (and also as a ""changed in"" on the `BooleanField` entry on the fields page) - particularly since it looks like several other people have hit the same issue:
https://github.com/django/django/commit/5fa4f40f45fcdbb7e48489ed3039a314b5c961d0#r30206260
https://code.djangoproject.com/ticket/29921

If I get a chance I'll open a PR in the next few weeks, but happy for someone to beat me to it.

Many thanks :-)"	Cleanup/optimization	closed	Documentation	2.1	Normal	fixed			Accepted	1	0	0	0	0	0
