def render(self, name, value, attrs=None, choices=()):
    new_choices = []
    initial_value = value
    for (opt_value, opt_label) in itertools.chain(self.choices, choices):
        other_html = self.transform_option_html_attrs(opt_label)
        data_attr_html = self.get_data_attrs(opt_label)
        if data_attr_html:
            other_html += (' ' + data_attr_html)
        opt_label = self.transform_option_label(opt_label)
        if (opt_value == value):
            initial_value = opt_label
        if other_html:
            new_choices.append((opt_value, opt_label, other_html))
        else:
            new_choices.append((opt_value, opt_label))
    if ((value is None) and new_choices):
        initial_value = new_choices[0][1]
    attrs = self.build_attrs(attrs)
    id = attrs.pop('id', ('id_%s' % name))
    template = get_template('horizon/common/fields/_themable_select.html')
    context = Context({'name': name, 'options': new_choices, 'id': id, 'value': value, 'initial_value': initial_value, 'select_attrs': attrs})
    return template.render(context)
def render(self, name, value, attrs=None, choices=()):
    new_choices = []
    initial_value = value
    for (opt_value, opt_label) in itertools.chain(self.choices, choices):
        other_html = self.transform_option_html_attrs(opt_label)
        data_attr_html = self.get_data_attrs(opt_label)
        if data_attr_html:
            other_html += (' ' + data_attr_html)
        opt_label = self.transform_option_label(opt_label)
        if (opt_value == value):
            initial_value = opt_label
        if other_html:
            new_choices.append((opt_value, opt_label, other_html))
        else:
            new_choices.append((opt_value, opt_label))
    if ((value is None) and new_choices):
        initial_value = new_choices[0][1]
    attrs = self.build_attrs(attrs)
    id = attrs.pop('id', ('id_%s' % name))
    template = get_template('horizon/common/fields/_themable_select.html')
    context = Context({'name': name, 'options': new_choices, 'id': id, 'value': value, 'initial_value': initial_value, 'select_attrs': attrs})
    return template.render(context)