From c1b70538a2f674d8685f1eebd54fe8600ab1fb7d Mon Sep 17 00:00:00 2001 From: Marlon Date: Sat, 5 Dec 2015 11:10:39 -0600 Subject: [PATCH] Resolve #3596 Uses #3597, but without using `Context`. --- rest_framework/filters.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rest_framework/filters.py b/rest_framework/filters.py index 66f1185a3..ff541ba1e 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -118,10 +118,9 @@ class DjangoFilterBackend(BaseFilterBackend): def to_html(self, request, queryset, view): filter_class = self.get_filter_class(view, queryset) - if filter_class: - filter_instance = filter_class(request.query_params, queryset=queryset) - else: - filter_instance = None + if not filter_class: + return None + filter_instance = filter_class(request.query_params, queryset=queryset) context = { 'filter': filter_instance }