mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Merge pull request #3560 from ericholscher/fix-empty-filter
Allow HTML to render when no filter_class is defined.
This commit is contained in:
commit
95f92e995c
|
@ -117,8 +117,11 @@ class DjangoFilterBackend(BaseFilterBackend):
|
|||
return queryset
|
||||
|
||||
def to_html(self, request, queryset, view):
|
||||
cls = self.get_filter_class(view, queryset)
|
||||
filter_instance = cls(request.query_params, queryset=queryset)
|
||||
filter_class = self.get_filter_class(view, queryset)
|
||||
if filter_class:
|
||||
filter_instance = filter_class(request.query_params, queryset=queryset)
|
||||
else:
|
||||
filter_instance = None
|
||||
context = Context({
|
||||
'filter': filter_instance
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user