diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 50b015352d..0a5ab372ec 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -179,6 +179,10 @@ class ChangeList(object): del lookup_params[key] lookup_params[smart_str(key)] = value + # if key ends with __in, split parameter into separate values + if key.endswith('__in'): + lookup_params[key] = value.split(',') + # Apply lookup parameters from the query string. qs = qs.filter(**lookup_params) diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index aaf1caafe7..d3deada0ed 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -102,7 +102,7 @@ class ForeignKeyRawIdWidget(forms.TextInput): def render(self, name, value, attrs=None): related_url = '../../../%s/%s/' % (self.rel.to._meta.app_label, self.rel.to._meta.object_name.lower()) if self.rel.limit_choices_to: - url = '?' + '&'.join(['%s=%s' % (k, v) for k, v in self.rel.limit_choices_to.items()]) + url = '?' + '&'.join(['%s=%s' % (k, ','.join(v)) for k, v in self.rel.limit_choices_to.items()]) else: url = '' if not attrs.has_key('class'):