#17981: attr property unexpectedly shared between widgets in MultiWidget
----------------------------+--------------------------------------
     Reporter:  supervacuo  |                    Owner:  nobody
         Type:  Bug         |                   Status:  new
    Component:  Forms       |                  Version:  1.4
     Severity:  Normal      |               Resolution:
     Keywords:              |             Triage Stage:  Unreviewed
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  1           |                    UI/UX:  0
----------------------------+--------------------------------------
Changes (by koenb):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 This is actually a bug in your code, not in django's. You are modifying
 the attrs object in your render method. Remember that objects are passed
 into functions by reference in python, so if the multiwidget passes a dict
 into the render method, you are changing that dict inside your method, not
 a copy.

 This is actually an easy mistake to make, so we may be able to protect
 against this in the multiwidget code. The patch I added to #5851 for
 instance does not have this problem anymore, since it passes a different
 dict into the different render methods.

 Not sure whether I should leave this open?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17981#comment:1>
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