diff --git a/django/newforms/widgets.py b/django/newforms/widgets.py index df8bb19c4f..4e4fc0c80b 100644 --- a/django/newforms/widgets.py +++ b/django/newforms/widgets.py @@ -172,14 +172,15 @@ class RadioInput(StrAndUnicode): def __init__(self, name, value, attrs, choice, index): self.name, self.value = name, value self.attrs = attrs - self.choice_value, self.choice_label = choice + self.choice_value = smart_unicode(choice[0]) + self.choice_label = smart_unicode(choice[1]) self.index = index def __unicode__(self): return u'' % (self.tag(), self.choice_label) def is_checked(self): - return self.value == smart_unicode(self.choice_value) + return self.value == self.choice_value def tag(self): if self.attrs.has_key('id'): diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index ad77d5795e..d185f1ceb8 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -527,12 +527,16 @@ True >>> r[1].is_checked() False >>> r[1].name, r[1].value, r[1].choice_value, r[1].choice_label -('beatle', u'J', 'P', 'Paul') +('beatle', u'J', u'P', u'Paul') >>> r[10] Traceback (most recent call last): ... IndexError: list index out of range +>>> w = RadioSelect() +>>> unicode(w.render('email', 'ŠĐĆŽćžšđ', choices=[('ŠĐĆŽćžšđ', 'ŠĐabcĆŽćžšđ'), ('ćžšđ', 'abcćžšđ')])) +u'' + # CheckboxSelectMultiple Widget ############################################### >>> w = CheckboxSelectMultiple()