#27433: ModelForm with BooleanField can not save False/unchecked
-------------------------------------+-------------------------------------
     Reporter:  Christian Pedersen   |                    Owner:  Ingo
                                     |  Klöcker
         Type:  Bug                  |                   Status:  closed
    Component:  Forms                |                  Version:  1.10
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Christian Pedersen):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 I found the problem. It turns out django-cassandra-engine overrides the
 construct_instance method.

 Change

 {{{
         if (field_has_default and form.add_prefix(f.name) not in form.data
 and
                 not getattr(form[f.name].field.widget,
                             'dont_use_model_field_default_for_empty_data',
                             False)):
             continue

 }}}

 to

 {{{
         if (field_has_default and
 form[f.name].field.widget.value_omitted_from_data(form.data, form.files,
 form.add_prefix(f.name))):
             continue
 }}}

 That explains why it works in 1.10.1 only.

--
Ticket URL: <https://code.djangoproject.com/ticket/27433#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.b7d86f4a034635b7b280b41bc761de38%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to