Skip to content

Commit

Permalink
Don't suppress TypeErrors in get_schema_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan P Kilby committed Oct 24, 2017
1 parent 11d1524 commit c7e9ecd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions django_filters/rest_framework/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def get_schema_fields(self, view):
assert compat.coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
assert compat.coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'

filter_class = getattr(view, 'filter_class', None)
if filter_class is None:
try:
filter_class = self.get_filter_class(view, view.get_queryset())
except Exception:
warnings.warn(
"{} is not compatible with schema generation".format(view.__class__)
)
filter_class = None
try:
queryset = view.get_queryset()
except Exception:
queryset = None
warnings.warn(
"{} is not compatible with schema generation".format(view.__class__)
)

filter_class = self.get_filter_class(view, queryset)

return [] if not filter_class else [
compat.coreapi.Field(
Expand Down

0 comments on commit c7e9ecd

Please sign in to comment.