A model instance is just a python object. You can set any attribute to any value.
When you save the instance, all data is converted to the appropriate data types to Django's best ability. For a BooleanField
this means that any truthy value (bool(value) is True
) is saved as True
and any falsy value (bool(value) is False
) is saved as False
.
When you save a model, the current values of the field is read, converted to an appropriate data type, and saved to the database. The original value of the field is not altered. When you reload the model from the database, the field will have the actual value saved in the database: True
.