Skip to content

Commit

Permalink
Merge remote-tracking branch 'brandenhall/master' into django21
Browse files Browse the repository at this point in the history
  • Loading branch information
bartTC committed Dec 9, 2018
2 parents 7c630cc + 5397140 commit 8f3e444
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dynamic_raw_id/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class DynamicRawIDImproperlyConfigured(ImproperlyConfigured):
class DynamicRawIDWidget(widgets.ForeignKeyRawIdWidget):
template_name = 'dynamic_raw_id/admin/widgets/dynamic_raw_id_field_dj111.html'

def render(self, name, value, attrs=None, multi=False):
def render(self, name, value, attrs=None, multi=False, renderer=None):
"""
Django <= 1.10 variant.
"""
DJANGO_111_OR_UP = (VERSION[0] == 1 and VERSION[1] >= 11) or (VERSION[0] >= 2)
if DJANGO_111_OR_UP:
return super(DynamicRawIDWidget, self).render(name, value, attrs, renderer=None)
return super(DynamicRawIDWidget, self).render(name, value, attrs, renderer=renderer)

if attrs is None:
attrs = {}
Expand Down Expand Up @@ -104,7 +104,7 @@ def value_from_datadict(self, data, files, name):
if value:
return value.split(u',')

def render(self, name, value, attrs):
def render(self, name, value, attrs, renderer=None):
attrs['class'] = 'vManyToManyRawIdAdminField'
value = u','.join([force_text(v) for v in value]) if value else ''
return super(DynamicRawIDMultiIdWidget, self).render(name, value, attrs)
return super(DynamicRawIDMultiIdWidget, self).render(name, value, attrs, renderer=renderer)

0 comments on commit 8f3e444

Please sign in to comment.