From 0ce76a92f37ffd718fed98296c0cd2cecfaa6993 Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Tue, 29 Apr 2008 01:09:53 +0000 Subject: [PATCH] newforms-admin: Fixed #7114 -- MultiWidget now calls decompress on initial data. Thanks Honza Kral. git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7503 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/newforms/widgets.py | 2 ++ tests/regressiontests/forms/widgets.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/django/newforms/widgets.py b/django/newforms/widgets.py index 8965a8c108..df5c20d97d 100644 --- a/django/newforms/widgets.py +++ b/django/newforms/widgets.py @@ -571,6 +571,8 @@ class MultiWidget(Widget): def _has_changed(self, initial, data): if initial is None: initial = [u'' for x in range(0, len(data))] + else: + initial = self.decompress(initial) for widget, initial, data in zip(self.widgets, initial, data): if not widget._has_changed(initial, data): return False diff --git a/tests/regressiontests/forms/widgets.py b/tests/regressiontests/forms/widgets.py index 0e69602103..d701879311 100644 --- a/tests/regressiontests/forms/widgets.py +++ b/tests/regressiontests/forms/widgets.py @@ -895,6 +895,12 @@ u'
< >>> w.render('name', ['john', 'lennon']) u'
' +>>> w = MyMultiWidget(widgets=(TextInput(), TextInput())) +>>> w._has_changed(None, ['john', 'lennon']) +True +>>> w._has_changed('john__lennon', ['john', 'lennon']) +False + # SplitDateTimeWidget ######################################################### >>> w = SplitDateTimeWidget()