Skip to content

Commit

Permalink
prevent uncaught exception on modified django-filter #519
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Sep 17, 2021
1 parent cd97613 commit 36251a8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drf_spectacular/contrib/django_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,7 @@ def _build_filter_method_type(self, filterset_class, filter_field):
return build_basic_type(OpenApiTypes.STR)

def _get_model_field(self, filter_field, model):
if not filter_field.field_name:
return None
path = filter_field.field_name.split('__')
return follow_field_source(model, path, emit_warnings=False)

0 comments on commit 36251a8

Please sign in to comment.