Check if view has a filter_class. If not, skip trying to get and append a filter html element for it.
This commit is contained in:
Marlon 2015-11-16 12:24:08 -06:00
parent 316c374b02
commit bdf3aeddde

View File

@ -592,9 +592,12 @@ class BrowsableAPIRenderer(BaseRenderer):
elements = []
for backend in view.filter_backends:
if hasattr(backend, 'to_html'):
html = backend().to_html(request, queryset, view)
if html:
elements.append(html)
if not hasattr(view, 'filter_class'):
return
else:
html = backend().to_html(request, queryset, view)
if html:
elements.append(html)
if not elements:
return