Permalink
Browse files

newforms-admin: Fixed #7114 -- MultiWidget now calls decompress on in…

…itial data. Thanks Honza Kral.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7503 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 8860050 commit 0ce76a92f37ffd718fed98296c0cd2cecfaa6993 @brosner brosner committed Apr 29, 2008
Showing with 8 additions and 0 deletions.
  1. +2 −0 django/newforms/widgets.py
  2. +6 −0 tests/regressiontests/forms/widgets.py
View
2 django/newforms/widgets.py
@@ -571,6 +571,8 @@ def value_from_datadict(self, data, files, name):
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
View
6 tests/regressiontests/forms/widgets.py
@@ -895,6 +895,12 @@
>>> w.render('name', ['john', 'lennon'])
u'<input id="bar_0" type="text" class="big" value="john" name="name_0" /><br /><input id="bar_1" type="text" class="small" value="lennon" name="name_1" />'
+>>> w = MyMultiWidget(widgets=(TextInput(), TextInput()))
+>>> w._has_changed(None, ['john', 'lennon'])
+True
+>>> w._has_changed('john__lennon', ['john', 'lennon'])
+False
+
# SplitDateTimeWidget #########################################################
>>> w = SplitDateTimeWidget()

0 comments on commit 0ce76a9

Please sign in to comment.