0
0
mirror of https://github.com/django/django.git synced 2024-11-29 22:56:46 +01:00

Allowed easier extendability of ChoiceFieldRenderer.

This commit is contained in:
TMFGravyHands 2015-06-11 07:52:03 -04:00 committed by Tim Graham
parent afa82aa41a
commit 339c01fb75

View File

@ -714,10 +714,12 @@ class ChoiceFieldRenderer(object):
attrs_plus = self.attrs.copy() attrs_plus = self.attrs.copy()
if id_: if id_:
attrs_plus['id'] += '_{}'.format(i) attrs_plus['id'] += '_{}'.format(i)
sub_ul_renderer = ChoiceFieldRenderer(name=self.name, sub_ul_renderer = self.__class__(
value=self.value, name=self.name,
attrs=attrs_plus, value=self.value,
choices=choice_label) attrs=attrs_plus,
choices=choice_label,
)
sub_ul_renderer.choice_input_class = self.choice_input_class sub_ul_renderer.choice_input_class = self.choice_input_class
output.append(format_html(self.inner_html, choice_value=choice_value, output.append(format_html(self.inner_html, choice_value=choice_value,
sub_widgets=sub_ul_renderer.render())) sub_widgets=sub_ul_renderer.render()))