From 577640bd04117573805d8b9ffa4670b999714db4 Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Tue, 2 Sep 2008 18:57:10 +0000 Subject: [PATCH] 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 --- django/contrib/admin/widgets.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index 32472cc7d8f..bad4702d92d 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -126,7 +126,14 @@ class ForeignKeyRawIdWidget(forms.TextInput): 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):