Skip to content

Commit

Permalink
fix renderer parameter in older django versions
Browse files Browse the repository at this point in the history
  • Loading branch information
manelclos committed Apr 26, 2020
1 parent 4467db8 commit fec2209
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions smart_selects/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ def render(self, name, value, attrs=None, choices=(), renderer=None): # noqa: C
else:
final_attrs['class'] = 'chained-fk'

output = super(ChainedSelect, self).render(name, value, final_attrs, renderer)
if renderer:
output = super(ChainedSelect, self).render(name, value, final_attrs, renderer)
else:
output = super(ChainedSelect, self).render(name, value, final_attrs)

return mark_safe(output)

Expand Down Expand Up @@ -262,6 +265,9 @@ def render(self, name, value, attrs=None, choices=(), renderer=None):
# For hozontal mode add django filter horizontal javascript selector class
final_attrs['class'] += ' selectfilter'
final_attrs['data-field-name'] = self.verbose_name
output = super(ChainedSelectMultiple, self).render(name, value, final_attrs, renderer)
if renderer:
output = super(ChainedSelectMultiple, self).render(name, value, final_attrs, renderer)
else:
output = super(ChainedSelectMultiple, self).render(name, value, final_attrs)

return mark_safe(output)

0 comments on commit fec2209

Please sign in to comment.