Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #15673 -- Allow limit_choices_to to use a tuple for __in filter…

…s. Thanks, EnTeQuAk.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 7478aeb commit 4da29717fd46234d5b44705646f629800c80982a @jezdez jezdez committed
2  django/contrib/admin/
@@ -99,7 +99,7 @@ def url_params_from_lookup_dict(lookups):
if lookups and hasattr(lookups, 'items'):
items = []
for k, v in lookups.items():
- if isinstance(v, list):
+ if isinstance(v, (tuple, list)):
v = u','.join([str(x) for x in v])
elif isinstance(v, bool):
# See django.db.fields.BooleanField.get_prep_lookup
9 tests/regressiontests/admin_widgets/
@@ -8,7 +8,8 @@
from django.contrib.admin import widgets
from django.contrib.admin.widgets import (FilteredSelectMultiple,
AdminSplitDateTime, AdminFileWidget, ForeignKeyRawIdWidget, AdminRadioSelect,
- RelatedFieldWidgetWrapper, ManyToManyRawIdWidget)
+ RelatedFieldWidgetWrapper, ManyToManyRawIdWidget,
+ url_params_from_lookup_dict)
from import default_storage
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models import DateField
@@ -180,6 +181,12 @@ def test_invalid_target_id(self):
'Select a valid choice. That choice is not one of the available choices.')
+ def test_url_params_from_lookup_dict_any_iterable(self):
+ lookup1 = url_params_from_lookup_dict({'color__in': ('red', 'blue')})
+ lookup2 = url_params_from_lookup_dict({'color__in': ['red', 'blue']})
+ self.assertEqual(lookup1, {'color__in': 'red,blue'})
+ self.assertEqual(lookup1, lookup2)
class FilteredSelectMultipleWidgetTest(TestCase):
def test_render(self):

0 comments on commit 4da2971

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