Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #7881: Support `__in` lookups in `limit_choices_to` and `raw_id…

…_admin`. Thanks, jamesturk.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8700 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 15416a90163d03e8b2253a1a52d3480c79744b9f 1 parent 21928f2
@jacobian jacobian authored
View
4 django/contrib/admin/views/main.py
@@ -179,6 +179,10 @@ def get_query_set(self):
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)
View
2  django/contrib/admin/widgets.py
@@ -102,7 +102,7 @@ def __init__(self, rel, attrs=None):
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'):

0 comments on commit 15416a9

Please sign in to comment.
Something went wrong with that request. Please try again.