Author: jezdez Date: 2011-04-22 05:03:50 -0700 (Fri, 22 Apr 2011) New Revision: 16078
Modified: django/trunk/django/contrib/admin/widgets.py django/trunk/tests/regressiontests/admin_widgets/tests.py Log: Fixed #15673 -- Allow limit_choices_to to use a tuple for __in filters. Thanks, EnTeQuAk. Modified: django/trunk/django/contrib/admin/widgets.py =================================================================== --- django/trunk/django/contrib/admin/widgets.py 2011-04-22 12:03:42 UTC (rev 16077) +++ django/trunk/django/contrib/admin/widgets.py 2011-04-22 12:03:50 UTC (rev 16078) @@ -99,7 +99,7 @@ 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 Modified: django/trunk/tests/regressiontests/admin_widgets/tests.py =================================================================== --- django/trunk/tests/regressiontests/admin_widgets/tests.py 2011-04-22 12:03:42 UTC (rev 16077) +++ django/trunk/tests/regressiontests/admin_widgets/tests.py 2011-04-22 12:03:50 UTC (rev 16078) @@ -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 django.core.files.storage import default_storage from django.core.files.uploadedfile import SimpleUploadedFile from django.db.models import DateField @@ -180,7 +181,13 @@ self.assertContains(response, '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): w = FilteredSelectMultiple('test', False) -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.