diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 4abc135..ee8ab5c 100644
|
a
|
b
|
class ChoiceFieldRenderer(object):
|
| 643 | 643 | """ |
| 644 | 644 | |
| 645 | 645 | choice_input_class = None |
| | 646 | outer_html = '<ul{id_attr}>{content}</ul>' |
| | 647 | inner_html = '<li>{choice_value}{sub_widgets}</li>' |
| 646 | 648 | |
| 647 | 649 | def __init__(self, name, value, attrs, choices): |
| 648 | 650 | self.name = name |
| … |
… |
class ChoiceFieldRenderer(object):
|
| 664 | 666 | item in the list will get an id of `$id_$i`). |
| 665 | 667 | """ |
| 666 | 668 | id_ = self.attrs.get('id', None) |
| 667 | | start_tag = format_html('<ul id="{0}">', id_) if id_ else '<ul>' |
| 668 | | output = [start_tag] |
| | 669 | output = [] |
| 669 | 670 | for i, choice in enumerate(self.choices): |
| 670 | 671 | choice_value, choice_label = choice |
| 671 | 672 | if isinstance(choice_label, (tuple, list)): |
| … |
… |
class ChoiceFieldRenderer(object):
|
| 677 | 678 | attrs=attrs_plus, |
| 678 | 679 | choices=choice_label) |
| 679 | 680 | sub_ul_renderer.choice_input_class = self.choice_input_class |
| 680 | | output.append(format_html('<li>{0}{1}</li>', choice_value, |
| 681 | | sub_ul_renderer.render())) |
| | 681 | output.append(format_html(self.inner_html, choice_value=choice_value, |
| | 682 | sub_widgets=sub_ul_renderer.render())) |
| 682 | 683 | else: |
| 683 | 684 | w = self.choice_input_class(self.name, self.value, |
| 684 | 685 | self.attrs.copy(), choice, i) |
| 685 | | output.append(format_html('<li>{0}</li>', force_text(w))) |
| 686 | | output.append('</ul>') |
| 687 | | return mark_safe('\n'.join(output)) |
| | 686 | output.append(format_html(self.inner_html, |
| | 687 | choice_value=force_text(w), sub_widgets='')) |
| | 688 | return format_html(self.outer_html, |
| | 689 | id_attr=format_html(' id="{0}"', id_) if id_ else '', |
| | 690 | content=mark_safe('\n'.join(output))) |
| 688 | 691 | |
| 689 | 692 | |
| 690 | 693 | class RadioFieldRenderer(ChoiceFieldRenderer): |