diff --git a/drf_spectacular/contrib/django_filters.py b/drf_spectacular/contrib/django_filters.py index 5b45e619..402e15c1 100644 --- a/drf_spectacular/contrib/django_filters.py +++ b/drf_spectacular/contrib/django_filters.py @@ -183,9 +183,16 @@ def resolve_filter_field(self, auto_schema, model, filterset_class, field_name, suffixes = filter_field.field_class.widget.suffixes except AttributeError: suffixes = ['min', 'max'] - field_names = [ - f'{field_name}_{suffix}' if suffix else field_name for suffix in suffixes - ] + # just in case widget family might be changed we check for method existence + suffixed = getattr(filter_field.field_class.widget(), "suffixed", None) + if suffixed and callable(suffixed): + field_names = [ + suffixed(field_name, suffix) for suffix in suffixes + ] + else: # keep default if no `suffixed` method exists on widget + field_names = [ + f'{field_name}_{suffix}' if suffix else field_name for suffix in suffixes + ] explode = None style = None else: