#16138: ModelForm's 'initial' attribute unexpectedly persists across different
instances
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  hanson2010                         |         Status:  new
                   Type:  Bug        |      Component:  Generic views
              Milestone:             |       Severity:  Normal
                Version:  1.3        |       Keywords:  model form, generic
             Resolution:             |  view
           Triage Stage:  Accepted   |      Has patch:  1
    Needs documentation:  1          |    Needs tests:  1
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by gabrielhurley):

 * needs_docs:  0 => 1
 * ui_ux:   => 0


Comment:

 `get_initial` shouldn't return an object that's unsafe to mutate, and I
 can't see a compelling reason for it to return an immutable object. The
 greatest flexibility would be afforded by a method as in the patch since
 it allows you to alter `self.initial` if you so desire, but also prevents
 the gotcha case of accidentally mutating the initial data for the entire
 process.

 This patch still needs a test case, and a note in the documentation would
 also be helpful.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16138#comment:4>
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to