Code

Ticket #4080: patch.diff

File patch.diff, 1.1 KB (added by Iwan Vosloo, 7 years ago)

Possible patch

Line 
1Index: django/newforms/widgets.py
2===================================================================
3--- django/newforms/widgets.py  (revision 5023)
4+++ django/newforms/widgets.py  (working copy)
5@@ -253,15 +253,15 @@
6 
7     def __unicode__(self):
8         "Outputs a <ul> for this set of radio fields."
9-        return u'<ul>\n%s\n</ul>' % u'\n'.join([u'<li>%s</li>' % w for w in self])
10+        return u'<ul%s>\n%s\n</ul>' % (flatatt(self.attrs), u'\n'.join([u'<li>%s</li>' % w for w in self]))
11 
12 class RadioSelect(Select):
13     def render(self, name, value, attrs=None, choices=()):
14         "Returns a RadioFieldRenderer instance rather than a Unicode string."
15         if value is None: value = ''
16         str_value = smart_unicode(value) # Normalize to string.
17-        attrs = attrs or {}
18-        return RadioFieldRenderer(name, str_value, attrs, list(chain(self.choices, choices)))
19+        final_attrs = self.build_attrs(attrs or {})
20+        return RadioFieldRenderer(name, str_value, final_attrs, list(chain(self.choices, choices)))
21 
22     def id_for_label(self, id_):
23         # RadioSelect is represented by multiple <input type="radio"> fields,