Ticket #3870: 3870.diff

File 3870.diff, 1.4 KB (added by Gary Wilson <gary.wilson@…>, 17 years ago)

use self.build_attrs

  • django/newforms/widgets.py

    === modified file 'django/newforms/widgets.py'
     
    250250        "Returns a RadioFieldRenderer instance rather than a Unicode string."
    251251        if value is None: value = ''
    252252        str_value = smart_unicode(value) # Normalize to string.
    253         attrs = attrs or {}
    254         return RadioFieldRenderer(name, str_value, attrs, list(chain(self.choices, choices)))
     253        final_attrs = self.build_attrs(attrs)
     254        return RadioFieldRenderer(name, str_value, final_attrs, list(chain(self.choices, choices)))
    255255
    256256    def id_for_label(self, id_):
    257257        # RadioSelect is represented by multiple <input type="radio"> fields,
     
    312312        super(MultiWidget, self).__init__(attrs)
    313313
    314314    def render(self, name, value, attrs=None):
     315        final_attrs = self.build_attrs(attrs)
    315316        # value is a list of values, each corresponding to a widget
    316317        # in self.widgets.
    317318        if not isinstance(value, list):
     
    322323                widget_value = value[i]
    323324            except KeyError:
    324325                widget_value = None
    325             output.append(widget.render(name + '_%s' % i, widget_value, attrs))
     326            output.append(widget.render(name + '_%s' % i, widget_value, final_attrs))
    326327        return self.format_output(output)
    327328
    328329    def value_from_datadict(self, data, name):
Back to Top