model_to_dict requires True, False, or '' instead of 0, 1, or '' when NullBooleanField
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have a model with
addr_to_photographer = models.NullBooleanField(blank=True, null=True)
and I have a custom save function in my model that uses model_to_dict.
Previously, the field was a regular models.BooleanField(), and in the json for my POST, I had to send 0, 1, or nothing to fill the value. Once I changed the field to be models.NullBooleanField, 0, 1, and nothing ALL stored as null. I had to change my POST json to send True, False, or nothing to get it to work. I just think it would be helpful to note this in the documentation about model_to_dict and/or NullBoolean. Thanks.