{{{
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/26168>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/26168#comment:1>
Comment (by jonashaag):
There's an outdated patch in #23130, which I still think is the best
solution to this problem. Somehow, I've never gotten around to finishing
the patch, but I think it should take no more than an hour of time to get
it up to date and pass the test suite.
--
Ticket URL: <https://code.djangoproject.com/ticket/26168#comment:2>
* cc: jonas@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/26168#comment:3>
* status: new => assigned
* owner: nobody => insomniac12
--
Ticket URL: <https://code.djangoproject.com/ticket/26168#comment:4>
* status: new => assigned
* owner: nobody => Lynn Cyrin
Comment:
The WIP PR https://github.com/django/django/pull/9016 I made for
https://code.djangoproject.com/ticket/23130 addresses this
--
Ticket URL: <https://code.djangoproject.com/ticket/26168#comment:4>
* cc: Kamil Gałuszka (added)
Comment:
I think this was fixed with https://github.com/django/django/pull/8467 and
#29227 . This ticket can be close then?
--
Ticket URL: <https://code.djangoproject.com/ticket/26168#comment:5>
* status: assigned => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/26168#comment:6>