From 3522b69394d932c8bf8028a456b6d9b64c38b54e Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 10 Feb 2015 10:51:38 +0100 Subject: [PATCH] Add `distinct` call in `filter_queryset` --- rest_framework/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/filters.py b/rest_framework/filters.py index d188a2d1e..d3f55a447 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -104,7 +104,7 @@ class SearchFilter(BaseFilterBackend): for search_term in self.get_search_terms(request): or_queries = [models.Q(**{orm_lookup: search_term}) for orm_lookup in orm_lookups] - queryset = queryset.filter(reduce(operator.or_, or_queries)) + queryset = queryset.filter(reduce(operator.or_, or_queries)).distinct() return queryset