diff --git a/django/forms/fields.py b/django/forms/fields.py
index 8abb1b3..3c030df 100644
a
|
b
|
class MultiValueField(Field):
|
971 | 971 | f.required = False |
972 | 972 | self.fields = fields |
973 | 973 | |
| 974 | def __deepcopy__(self, memo): |
| 975 | result = super(MultiValueField, self).__deepcopy__(memo) |
| 976 | result.fields = tuple([x.__deepcopy__(memo) for x in self.fields]) |
| 977 | return result |
| 978 | |
974 | 979 | def validate(self, value): |
975 | 980 | pass |
976 | 981 | |
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 168bc1d..18ab38f 100644
a
|
b
|
|
2 | 2 | from __future__ import unicode_literals |
3 | 3 | |
4 | 4 | import datetime |
| 5 | import copy |
5 | 6 | |
6 | 7 | from django.core.files.uploadedfile import SimpleUploadedFile |
7 | 8 | from django.core.validators import RegexValidator |
… |
… |
class FormsTestCase(TestCase):
|
1793 | 1794 | self.assertTrue(form.is_valid()) |
1794 | 1795 | self.assertEqual(form.cleaned_data, {'name' : 'fname lname'}) |
1795 | 1796 | |
| 1797 | def test_deep_copy(self): |
| 1798 | class ChoicesField(MultiValueField): |
| 1799 | def __init__(self, fields=(), *args, **kwargs): |
| 1800 | fields = (ChoiceField(label='Rank', |
| 1801 | choices=((1,1),(2,2))), |
| 1802 | CharField(label='Name', max_length=10)) |
| 1803 | super(ChoicesField, self).__init__(fields=fields, *args, **kwargs) |
| 1804 | |
| 1805 | |
| 1806 | field = ChoicesField() |
| 1807 | field2 = copy.deepcopy(field) |
| 1808 | self.assertTrue(isinstance(field2, ChoicesField)) |
| 1809 | self.assertFalse(id(field2.fields) == id(field.fields)) |
| 1810 | self.assertFalse(id(field2.fields[0].choices) == |
| 1811 | id(field.fields[0].choices)) |
| 1812 | |
1796 | 1813 | def test_multivalue_optional_subfields(self): |
1797 | 1814 | class PhoneField(MultiValueField): |
1798 | 1815 | def __init__(self, *args, **kwargs): |