Issue
I have some ViewSet with filterset_fields
and ordering_fields
attributes. Also i have extra action in that ViewSet, that uses as a shortcut to get list with some filtration. I assume to use that extra action without handling any additional filter(or may be ordering) options. But in default way drf-yasg genereates parameters schema for that extra action with filterset_fields
and ordering_fields
.
How i can ignore filterset_fields
and ordering_fields
attributes for specific endpoint?
Solution
In your action decorator set filterset_fields and ordering_fields to an empty list:
@action(detail=False, methods=['GET'], filterset_fields=[], ordering_fields=[], search_fields=[])
You can go even further and disable filter_backends:
@action(detail=False, methods=['GET'], filter_backends=[])
Answered By - Руслан Шамсутдинов
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.