From 339c01fb7552feb8df125ef7e5420dae04fd913f Mon Sep 17 00:00:00 2001 From: TMFGravyHands Date: Thu, 11 Jun 2015 07:52:03 -0400 Subject: [PATCH] Allowed easier extendability of ChoiceFieldRenderer. --- django/forms/widgets.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/django/forms/widgets.py b/django/forms/widgets.py index cc82c2ec79..896984dc08 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -714,10 +714,12 @@ class ChoiceFieldRenderer(object): attrs_plus = self.attrs.copy() if id_: attrs_plus['id'] += '_{}'.format(i) - sub_ul_renderer = ChoiceFieldRenderer(name=self.name, - value=self.value, - attrs=attrs_plus, - choices=choice_label) + sub_ul_renderer = self.__class__( + name=self.name, + value=self.value, + attrs=attrs_plus, + choices=choice_label, + ) sub_ul_renderer.choice_input_class = self.choice_input_class output.append(format_html(self.inner_html, choice_value=choice_value, sub_widgets=sub_ul_renderer.render()))