mirror of
https://github.com/django/django.git
synced 2024-12-23 09:36:06 +00:00
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
This commit is contained in:
parent
21928f2ba0
commit
15416a9016
@ -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)
|
||||
|
||||
|
@ -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'):
|
||||
|
Loading…
Reference in New Issue
Block a user