﻿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
35659	Document db_default behaviour before instances are saved	Markus Andresen	Jerome Cagado	"There seems to be an unexpected behavior when using the db_default attribute on a BooleanField. The bool() evaluation when the instance is not saved to the database does not reflect the specified db_default value.

Steps to Reproduce:

{{{
from django.db import models

class MyModel(models.Model):
    my_field = models.BooleanField(db_default=False)

my_obj = MyModel()
bool(my_obj.my_field)  # True, which is unexpected.

my_obj.save()
bool(my_obj.my_field)  #  False, as expected.

}}}

I know this can be worked around by adding a default attribute in addition to db_default, but in my opinion its not clear enough from the documentation that you have to.


"	Cleanup/optimization	assigned	Documentation	5.0	Normal		db_default	Ülgen Sarıkavak Lily	Accepted	1	0	0	1	0	0
