Ticket #14158: 14158.diff

File 14158.diff, 1.2 KB (added by Daniel F Moisset, 14 years ago)
  • django/forms/widgets.py

    diff --git a/django/forms/widgets.py b/django/forms/widgets.py
    index cb12586..e317c8a 100644
    a b class SelectMultiple(Select):  
    589589            data = []
    590590        if len(initial) != len(data):
    591591            return True
    592         for value1, value2 in zip(initial, data):
    593             if force_unicode(value1) != force_unicode(value2):
    594                 return True
    595         return False
     592        initial_set = set([force_unicode(value) for value in initial])
     593        data_set = set([force_unicode(value) for value in data])
     594        return data_set != initial_set:
    596595
    597596class RadioInput(StrAndUnicode):
    598597    """
  • tests/regressiontests/forms/widgets.py

    diff --git a/tests/regressiontests/forms/widgets.py b/tests/regressiontests/forms/widgets.py
    index 2c21d19..0997372 100644
    a b False  
    673673True
    674674>>> w._has_changed([1, 2], [u'1', u'3'])
    675675True
     676>>> w._has_changed([2, 1], [u'1', u'2'])
     677False
    676678
    677679# Choices can be nested one level in order to create HTML optgroups:
    678680>>> w.choices = (('outer1', 'Outer 1'), ('Group "1"', (('inner1', 'Inner 1'), ('inner2', 'Inner 2'))))
Back to Top