Opened 4 years ago
Closed 14 months ago
#26168 closed Cleanup/optimization (fixed)
BooleanField is forced to be blank=True
Description
def __init__(self, *args, **kwargs): kwargs['blank'] = True super(BooleanField, self).__init__(*args, **kwargs)
blank is set to True forcibly
I want my BooleanField always explicitly set(without a default value), like this:
myflag = models.BooleanField(blank=False)
but with this
kwargs['blank'] =True, Django does not complain if field
myflag not set, but try to use default of BooleanField(in 1.7.5, None) which lead to exception when saving~
I think force blank = True makes sense for NullBooleanField, but for BooleanField, we can leave it to user.
Thanks.
Change History (6)
comment:1 Changed 4 years ago by
comment:2 Changed 4 years ago by
comment:3 Changed 4 years ago by
comment:4 Changed 2 years ago by
comment:5 Changed 14 months ago by
I think this was fixed with and #29227 . This ticket can be close then?
See #22282 and #23130 for some related discussion. I'm not sure what the proper resolution is, but I'll accept the ticket since this this has come up several time. We can at least document the reasons for this if it can't be changed for backwards compatibility reasons.