Ejemplo n.º 1
0
    def _get_pagination_parameters(self):
        if not self._is_list_view():
            return []

        paginator = self._get_paginator()
        if not paginator:
            return []

        filter_extension = OpenApiFilterExtension.get_match(paginator)
        if filter_extension:
            return filter_extension.get_schema_operation_parameters(self)
        else:
            return paginator.get_schema_operation_parameters(self.view)
Ejemplo n.º 2
0
 def get_filter_params_for_search(self):
     """copy paste of self._get_filter_parameters() without conditions"""
     parameters = []
     for filter_backend in self.view.filter_backends:
         filter_extension = OpenApiFilterExtension.get_match(
             filter_backend())
         if filter_extension:
             parameters += filter_extension.get_schema_operation_parameters(
                 self)
         else:
             parameters += filter_backend().get_schema_operation_parameters(
                 self.view)
     return parameters
Ejemplo n.º 3
0
    def _get_filter_parameters(self):
        if not self._is_list_view():
            return []
        if getattr(self.view, 'filter_backends', None) is None:
            return []

        parameters = []
        for filter_backend in self.view.filter_backends:
            filter_extension = OpenApiFilterExtension.get_match(filter_backend())
            if filter_extension:
                parameters += filter_extension.get_schema_operation_parameters(self)
            else:
                parameters += filter_backend().get_schema_operation_parameters(self.view)
        return parameters