From e316b8b981344c6f4663ddcec268e995db61202e Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Tue, 9 Mar 2010 22:52:04 +0000 Subject: [PATCH] Fixed #12048 - MultiWidget does not define `__deepcopy__` Thanks to powderflask for report, test case and initial patch git-svn-id: http://code.djangoproject.com/svn/django/trunk@12739 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/forms/widgets.py | 5 ++++ tests/regressiontests/forms/tests.py | 1 + tests/regressiontests/forms/widgets.py | 40 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 482888da50..8b4112bec5 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -738,6 +738,11 @@ class MultiWidget(Widget): media = media + w.media return media media = property(_get_media) + + def __deepcopy__(self, memo): + obj = super(MultiWidget, self).__deepcopy__(memo) + obj.widgets = copy.deepcopy(self.widgets) + return obj class SplitDateTimeWidget(MultiWidget): """ diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index db70500909..8757e799a9 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -39,6 +39,7 @@ from media import media_tests from fields import FieldsTests from validators import TestFieldWithValidators +from widgets import WidgetTests __test__ = { 'extra_tests': extra_tests, diff --git a/tests/regressiontests/forms/widgets.py b/tests/regressiontests/forms/widgets.py index d862f40b01..cc83a888cf 100644 --- a/tests/regressiontests/forms/widgets.py +++ b/tests/regressiontests/forms/widgets.py @@ -1269,3 +1269,43 @@ u'