#3810: Widgets should take a copy of the attrs dict
---------------------------+------------------------------------------------
   Reporter:  SmileyChris  |                Owner:  adrian         
     Status:  new          |            Component:  django.newforms
    Version:  SVN          |           Resolution:                 
   Keywords:               |                Stage:  Unreviewed     
  Has_patch:  0            |           Needs_docs:  0              
Needs_tests:  0            |   Needs_better_patch:  0              
---------------------------+------------------------------------------------
Comment (by SmileyChris):

 This issue came up when dealing with someone on IRC (if I recall
 correctly).
 
 They had something like this for their form:
 {{{
 #!python
 from django.newforms import *
 
 extra_attrs = {'class': 'special'}
 class TestForm(Form):
     field1 = CharField(max_length=10, widget=TextInput(attrs=extra_attrs))
     field2 = CharField(widget=TextInput(attrs=extra_attrs))
 }}}
 
 Which incorrectly renders (with `TestForm(auto_id=False).as_p()`) to:
 {{{
 <p>Field1: <input type="text" class="special" name="field1"
 maxlength="10"/></p>
 <p>Field2: <input type="text" class="special" name="field2" maxlength="10"
 /></p>
 }}}
 
 (note the second `maxlength="10"`, because `extra_attrs` was changed in
 place)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3810#comment:2>
Django Code <http://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