From 5a21f766b49560f47c7501a10aacaac4922b62a6 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Thu, 13 May 2021 11:52:34 +0200 Subject: [PATCH] Add required param `renderer` to Widget.render Added on Django 1.11 and required since 2.1 The renderer argument is added to the Widget.render() method. https://docs.djangoproject.com/en/2.1/releases/1.11/#id2 --- orchestra/forms/widgets.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/orchestra/forms/widgets.py b/orchestra/forms/widgets.py index a3a686df..0235db61 100644 --- a/orchestra/forms/widgets.py +++ b/orchestra/forms/widgets.py @@ -17,9 +17,9 @@ class SpanWidget(forms.Widget): self.original = kwargs.pop('original', '') self.display = kwargs.pop('display', None) super(SpanWidget, self).__init__(*args, **kwargs) - - def render(self, name, value, attrs=None): - final_attrs = self.build_attrs(attrs, name=name) + + def render(self, name, value, attrs=None, renderer=None): + final_attrs = self.build_attrs(attrs, extra_attrs={'name':name}) original = self.original or value display = original if self.display is None else self.display # Display icon @@ -29,10 +29,10 @@ class SpanWidget(forms.Widget): tag = self.tag[:-1] endtag = '/'.join((self.tag[0], self.tag[1:])) return mark_safe('%s%s >%s%s' % (tag, forms.utils.flatatt(final_attrs), display, endtag)) - + def value_from_datadict(self, data, files, name): return self.original - + def _has_changed(self, initial, data): return False @@ -61,7 +61,7 @@ class DynamicHelpTextSelect(forms.Select): attrs.update(kwargs.get('attrs', {})) kwargs['attrs'] = attrs super(DynamicHelpTextSelect, self).__init__(*args, **kwargs) - + def get_dynamic_help_text(self, target, help_text): return textwrap.dedent("""\ siteoptions = {help_text};