#27039: ModelFields with 'default' value set and 'required'=False in form does 
not
use default value
-------------------------------------+-------------------------------------
     Reporter:  devbis               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Forms                |                  Version:  1.10
     Severity:  Release blocker      |               Resolution:
     Keywords:  default non-         |             Triage Stage:  Accepted
  required modelform                 |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by timgraham):

 * needs_better_patch:  0 => 1
 * needs_tests:  1 => 0


Comment:

 I drafted a [https://github.com/django/django/pull/7068 pull request],
 however, it demonstrates a small problem with the idea that values not
 present in POST data should fallback to their default. For HTML widgets
 like checkboxes, if the element isn't checked, it won't appear in POST
 data. In such a case, it's inappropriate to fallback to the model field's
 default if it's True. The current patch special cases this with
 `isinstance(form[f.name].field.widget, CheckboxInput)` to fix some test
 failures but that hardly seems ideal.

--
Ticket URL: <https://code.djangoproject.com/ticket/27039#comment:6>
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/064.f4d3476200b72644cee972d5344b1fb7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to