Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 0ce76a92f37ffd718fed98296c0cd2cecfaa6993 1 parent 8860050
Brian Rosner authored April 29, 2008
2  django/newforms/widgets.py
@@ -571,6 +571,8 @@ def value_from_datadict(self, data, files, name):
571 571
     def _has_changed(self, initial, data):
572 572
         if initial is None:
573 573
             initial = [u'' for x in range(0, len(data))]
  574
+        else:
  575
+            initial = self.decompress(initial)
574 576
         for widget, initial, data in zip(self.widgets, initial, data):
575 577
             if not widget._has_changed(initial, data):
576 578
                 return False
6  tests/regressiontests/forms/widgets.py
@@ -895,6 +895,12 @@
895 895
 >>> w.render('name', ['john', 'lennon'])
896 896
 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" />'
897 897
 
  898
+>>> w = MyMultiWidget(widgets=(TextInput(), TextInput()))
  899
+>>> w._has_changed(None, ['john', 'lennon'])
  900
+True
  901
+>>> w._has_changed('john__lennon', ['john', 'lennon'])
  902
+False
  903
+
898 904
 # SplitDateTimeWidget #########################################################
899 905
 
900 906
 >>> w = SplitDateTimeWidget()

0 notes on commit 0ce76a9

Please sign in to comment.
Something went wrong with that request. Please try again.