Skip to content

Commit

Permalink
Fixed #8805 -- Make sure proper type coercion happens before dumping …
Browse files Browse the repository at this point in the history
…data into join for limit_choices_to when building the URL parameters for the ForeignKeyRawIdWidget popup.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8867 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
brosner committed Sep 2, 2008
1 parent 58e3ef7 commit 577640b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion django/contrib/admin/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,14 @@ def render(self, name, value, attrs=None):
def base_url_parameters(self):
params = {}
if self.rel.limit_choices_to:
params.update(dict([(k, ','.join(v)) for k, v in self.rel.limit_choices_to.items()]))
items = []
for k, v in self.rel.limit_choices_to.items():
if isinstance(v, list):
v = [str(x) for x in v]
else:
v = str(v)
items.append((k, ','.join(v)))
params.update(dict(items))
return params

def url_parameters(self):
Expand Down

0 comments on commit 577640b

Please sign in to comment.