Ticket #4080: patch.diff

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

Possible patch

  • django/newforms/widgets.py

     
    253253
    254254    def __unicode__(self):
    255255        "Outputs a <ul> for this set of radio fields."
    256         return u'<ul>\n%s\n</ul>' % u'\n'.join([u'<li>%s</li>' % w for w in self])
     256        return u'<ul%s>\n%s\n</ul>' % (flatatt(self.attrs), u'\n'.join([u'<li>%s</li>' % w for w in self]))
    257257
    258258class RadioSelect(Select):
    259259    def render(self, name, value, attrs=None, choices=()):
    260260        "Returns a RadioFieldRenderer instance rather than a Unicode string."
    261261        if value is None: value = ''
    262262        str_value = smart_unicode(value) # Normalize to string.
    263         attrs = attrs or {}
    264         return RadioFieldRenderer(name, str_value, attrs, list(chain(self.choices, choices)))
     263        final_attrs = self.build_attrs(attrs or {})
     264        return RadioFieldRenderer(name, str_value, final_attrs, list(chain(self.choices, choices)))
    265265
    266266    def id_for_label(self, id_):
    267267        # RadioSelect is represented by multiple <input type="radio"> fields,
Back to Top