#16539: ModelForms ignore default values when value is not supplied
--------------------------------------+----------------------------
               Reporter:  semarjt@…   |          Owner:  nobody
                   Type:  Bug         |         Status:  closed
              Milestone:              |      Component:  Forms
                Version:  1.3         |       Severity:  Normal
             Resolution:  invalid     |       Keywords:  Model|Form
           Triage Stage:  Unreviewed  |      Has patch:  0
    Needs documentation:  0           |    Needs tests:  0
Patch needs improvement:  0           |  Easy pickings:  1
                  UI/UX:  0           |
--------------------------------------+----------------------------
Changes (by kmtracey):

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


Comment:

 For the original problem description: your issue is with how HTML checkbox
 inputs work. If a checkbox is not checked, the browser supplies no value
 for it when posting the form. Therefore Django must interpret no value
 present for a checkbox widget in a form's data to be "not checked", or
 False. If you want to allow for not specifying a value falling back to a
 default of True, you'll have to use some type of widget other than a
 checkbox.

 For the follow-up comment: Django uses the default value when it creates
 model instances. It does not propagate that default value to the SQL for
 the table. This is design decision, not a bug.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16539#comment:3>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to