From fbeb1811fee65e438c82a7896237ee279aac3146 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 13 Dec 2017 19:50:41 -0500 Subject: [PATCH] Fix complex filtering + pagination --- rest_framework_filters/backends.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rest_framework_filters/backends.py b/rest_framework_filters/backends.py index 100497f..1ee1685 100644 --- a/rest_framework_filters/backends.py +++ b/rest_framework_filters/backends.py @@ -3,7 +3,6 @@ from django.http import QueryDict from django_filters.rest_framework import backends from rest_framework.exceptions import ValidationError -from rest_framework.request import clone_request from .complex_ops import decode_querystring_ops, OPERATORS from .filterset import FilterSet @@ -47,6 +46,7 @@ class ComplexFilterBackend(DjangoFilterBackend): def filter_queryset(self, request, original, view): parent = super(ComplexFilterBackend, self) + original_GET = request._request.GET if self.complex_filter_param not in request.query_params: return parent.filter_queryset(request, original, view) @@ -61,10 +61,10 @@ def filter_queryset(self, request, original, view): queryset_op = OPERATORS['&'] # effectively a noop for querystring, op in querystring_ops: - cloned = clone_request(request, request.method) - cloned._request.GET = QueryDict(querystring) + request._request.GET = QueryDict(querystring) - queryset = queryset_op(queryset, parent.filter_queryset(cloned, original, view)) + queryset = queryset_op(queryset, parent.filter_queryset(request, original, view)) queryset_op = OPERATORS.get(op) + request._request.GET = original_GET return queryset