{"action":"created","issue":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2629","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2629/labels{/name}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2629/comments","events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2629/events","html_url":"https://github.com/tomchristie/django-rest-framework/issues/2629","id":59675102,"number":2629,"title":"Consider always returning a QuerySet in paginate_queryset","user":{"login":"JockeTF","id":532268,"avatar_url":"https://avatars.githubusercontent.com/u/532268?v=3","gravatar_id":"","url":"https://api.github.com/users/JockeTF","html_url":"https://github.com/JockeTF","followers_url":"https://api.github.com/users/JockeTF/followers","following_url":"https://api.github.com/users/JockeTF/following{/other_user}","gists_url":"https://api.github.com/users/JockeTF/gists{/gist_id}","starred_url":"https://api.github.com/users/JockeTF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JockeTF/subscriptions","organizations_url":"https://api.github.com/users/JockeTF/orgs","repos_url":"https://api.github.com/users/JockeTF/repos","events_url":"https://api.github.com/users/JockeTF/events{/privacy}","received_events_url":"https://api.github.com/users/JockeTF/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/labels/Needs%20design%20decision","name":"Needs design decision","color":"c7def8"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/milestones/6","html_url":"https://github.com/tomchristie/django-rest-framework/milestones/3.1.0%20Release","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/milestones/6/labels","id":757108,"number":6,"title":"3.1.0 Release","description":"The 'feature improvements' stretch goal.","creator":{"login":"tomchristie","id":647359,"avatar_url":"https://avatars.githubusercontent.com/u/647359?v=3","gravatar_id":"","url":"https://api.github.com/users/tomchristie","html_url":"https://github.com/tomchristie","followers_url":"https://api.github.com/users/tomchristie/followers","following_url":"https://api.github.com/users/tomchristie/following{/other_user}","gists_url":"https://api.github.com/users/tomchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchristie/subscriptions","organizations_url":"https://api.github.com/users/tomchristie/orgs","repos_url":"https://api.github.com/users/tomchristie/repos","events_url":"https://api.github.com/users/tomchristie/events{/privacy}","received_events_url":"https://api.github.com/users/tomchristie/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":56,"state":"open","created_at":"2014-08-18T10:33:03Z","updated_at":"2015-03-04T16:19:30Z","due_on":"2015-03-11T00:00:00Z","closed_at":null},"comments":2,"created_at":"2015-03-03T17:25:07Z","updated_at":"2015-03-04T16:19:30Z","closed_at":"2015-03-04T16:19:30Z","body":"The` paginate_queryset` method of the built in `Pagination` classes return objects of varying type.\r\n\r\n- `PageNumberPagination.paginate_queryset` returns a `Page`.\r\n- `LimitOffsetPagination.paginate_queryset` returns a `QuerySet`.\r\n- `CursorPagination.paginate_queryset` returns a `list`.\r\n\r\nI suggest that these methods should all return a `QuerySet`.\r\n\r\nI need to perform optimizations *after* pagination since I depend on having a complete list of object IDs for raw queries. However, since I also make calls to `annotate` and `prefetch_related` within my optimizers I still would like access to the `QuerySet`.\r\n\r\nThis makes performing optimizations for list views more difficult since I have to take the different `instance` types into account. Switching from `PageNumberPagination` to `CursorPagination` would also be problematic since I would no longer have a `QuerySet` to work with."},"comment":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/comments/77189079","html_url":"https://github.com/tomchristie/django-rest-framework/issues/2629#issuecomment-77189079","issue_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2629","id":77189079,"user":{"login":"tomchristie","id":647359,"avatar_url":"https://avatars.githubusercontent.com/u/647359?v=3","gravatar_id":"","url":"https://api.github.com/users/tomchristie","html_url":"https://github.com/tomchristie","followers_url":"https://api.github.com/users/tomchristie/followers","following_url":"https://api.github.com/users/tomchristie/following{/other_user}","gists_url":"https://api.github.com/users/tomchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchristie/subscriptions","organizations_url":"https://api.github.com/users/tomchristie/orgs","repos_url":"https://api.github.com/users/tomchristie/repos","events_url":"https://api.github.com/users/tomchristie/events{/privacy}","received_events_url":"https://api.github.com/users/tomchristie/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T16:19:30Z","updated_at":"2015-03-04T16:19:30Z","body":"We can't make it always be a queryset, as it may not even have been passed a queryset as input (it could just as validly be a plain list) However it would be more consitent if the returned pages were always exposed as plain lists, which they now are."}}