Add docs note re generated BooleanField being required=False (#5665)

* Note that BooleanField default is required=False

Closes #5664
This commit is contained in:
Carlton Gibson 2017-12-14 11:39:54 +01:00 committed by GitHub
parent 791539acec
commit 2359d3981b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,6 +124,8 @@ A boolean representation.
When using HTML encoded form input be aware that omitting a value will always be treated as setting a field to `False`, even if it has a `default=True` option specified. This is because HTML checkbox inputs represent the unchecked state by omitting the value, so REST framework treats omission as if it is an empty checkbox input.
Note that default `BooleanField` instances will be generated with a `required=False` option (since Django `models.BooleanField` is always `blank=True`). If you want to change this behaviour explicitly declare the `BooleanField` on the serializer class.
Corresponds to `django.db.models.fields.BooleanField`.
**Signature:** `BooleanField()`