Ticket #4080: patch.diff
File patch.diff, 1.1 KB (added by , 18 years ago) |
---|
-
django/newforms/widgets.py
253 253 254 254 def __unicode__(self): 255 255 "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])) 257 257 258 258 class RadioSelect(Select): 259 259 def render(self, name, value, attrs=None, choices=()): 260 260 "Returns a RadioFieldRenderer instance rather than a Unicode string." 261 261 if value is None: value = '' 262 262 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))) 265 265 266 266 def id_for_label(self, id_): 267 267 # RadioSelect is represented by multiple <input type="radio"> fields,