Fixed #8805 -- Make sure proper type coercion happens before dumping 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
This commit is contained in:
Brian Rosner 2008-09-02 18:57:10 +00:00
parent 58e3ef76db
commit 577640bd04
1 changed files with 8 additions and 1 deletions

View File

@ -126,7 +126,14 @@ class ForeignKeyRawIdWidget(forms.TextInput):
def base_url_parameters(self): def base_url_parameters(self):
params = {} params = {}
if self.rel.limit_choices_to: 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 return params
def url_parameters(self): def url_parameters(self):