diff --git a/rest_framework/schemas.py b/rest_framework/schemas.py index f02805d06..6640a8d31 100644 --- a/rest_framework/schemas.py +++ b/rest_framework/schemas.py @@ -279,9 +279,9 @@ class APIViewSchemaDescriptor(object): fields = self.get_path_fields(path, method) fields += self.get_serializer_fields(path, method) + fields += self.get_pagination_fields(path, method) # TEMP: now we proxy back to the generator - fields += generator.get_pagination_fields(path, method, view) fields += generator.get_filter_fields(path, method, view) if fields and any([field.location in ('form', 'body') for field in fields]): @@ -429,6 +429,19 @@ class APIViewSchemaDescriptor(object): return fields + def get_pagination_fields(self, path, method): + view = self.view + + if not is_list_view(path, method, view): + return [] + + pagination = getattr(view, 'pagination_class', None) + if not pagination: + return [] + + paginator = view.pagination_class() + return paginator.get_schema_fields(view) + # TODO: Where should this live? # - We import APIView here. So we can't import the descriptor into `views` @@ -637,17 +650,6 @@ class SchemaGenerator(object): return None - def get_pagination_fields(self, path, method, view): - if not is_list_view(path, method, view): - return [] - - pagination = getattr(view, 'pagination_class', None) - if not pagination: - return [] - - paginator = view.pagination_class() - return paginator.get_schema_fields(view) - def get_filter_fields(self, path, method, view): if not is_list_view(path, method, view): return []