From 41412f9392a8f06363755e5ca590ddf742f707b8 Mon Sep 17 00:00:00 2001 From: Javier Chamizo Date: Sat, 7 Feb 2015 04:00:29 +0100 Subject: [PATCH] Python 2.6 compatibility Change on transformation to make it compatible with python 2.6 --- rest_framework/filters.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rest_framework/filters.py b/rest_framework/filters.py index ff18bb55b..0cbe2fe07 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -65,9 +65,10 @@ class DjangoFilterBackend(BaseFilterBackend): filter_class = self.get_filter_class(view, queryset) if filter_class: - # Using solution by @leo-the-manic goo.gl/3LoFIj + # Inspired by @leo-the-manic goo.gl/3LoFIj return filter_class( - {k: v[0] if len(v) == 1 else v for k, v in request.query_params.lists()}, + dict([(param[0], len(param[1]) == 1 and param[1][0] or param[1]) + for param in request.query_params.lists()]), queryset=queryset ).qs