Ticket #3489: deepcopy.diff
File deepcopy.diff, 1.8 KB (added by , 18 years ago) |
---|
-
django/newforms/forms.py
28 28 dict.__init__(self, dict(data)) 29 29 30 30 def copy(self): 31 return SortedDictFromList([(k, copy. copy(v)) for k, v in self.items()])31 return SortedDictFromList([(k, copy.deepcopy(v)) for k, v in self.items()]) 32 32 33 33 class DeclarativeFieldsMetaclass(type): 34 34 """ -
tests/regressiontests/forms/tests.py
2397 2397 ... super(Person, self).__init__(*args, **kwargs) 2398 2398 ... if names_required: 2399 2399 ... self.fields['first_name'].required = True 2400 ... self.fields['first_name'].widget.attrs['class'] = 'required' 2400 2401 ... self.fields['last_name'].required = True 2402 ... self.fields['last_name'].widget.attrs['class'] = 'required' 2401 2403 >>> f = Person(names_required=False) 2402 2404 >>> f['first_name'].field.required, f['last_name'].field.required 2403 2405 (False, False) 2406 >>> f['first_name'].field.widget.attrs, f['last_name'].field.widget.attrs 2407 ({}, {}) 2404 2408 >>> f = Person(names_required=True) 2405 2409 >>> f['first_name'].field.required, f['last_name'].field.required 2406 2410 (True, True) 2411 >>> f['first_name'].field.widget.attrs, f['last_name'].field.widget.attrs 2412 ({'class': 'required'}, {'class': 'required'}) 2407 2413 >>> f = Person(names_required=False) 2408 2414 >>> f['first_name'].field.required, f['last_name'].field.required 2409 2415 (False, False) 2416 >>> f['first_name'].field.widget.attrs, f['last_name'].field.widget.attrs 2417 ({}, {}) 2410 2418 >>> class Person(Form): 2411 2419 ... first_name = CharField(max_length=30) 2412 2420 ... last_name = CharField(max_length=30)