{"action":"created","issue":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3284","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3284/labels{/name}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3284/comments","events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3284/events","html_url":"https://github.com/tomchristie/django-rest-framework/issues/3284","id":101488410,"number":3284,"title":"Regression implementing custom pagination upgrading to 3.2.0 (from 3.1.3)","user":{"login":"arw180","id":65660,"avatar_url":"https://avatars.githubusercontent.com/u/65660?v=3","gravatar_id":"","url":"https://api.github.com/users/arw180","html_url":"https://github.com/arw180","followers_url":"https://api.github.com/users/arw180/followers","following_url":"https://api.github.com/users/arw180/following{/other_user}","gists_url":"https://api.github.com/users/arw180/gists{/gist_id}","starred_url":"https://api.github.com/users/arw180/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arw180/subscriptions","organizations_url":"https://api.github.com/users/arw180/orgs","repos_url":"https://api.github.com/users/arw180/repos","events_url":"https://api.github.com/users/arw180/events{/privacy}","received_events_url":"https://api.github.com/users/arw180/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/labels/Needs%20further%20review","name":"Needs further review","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/milestones/30","html_url":"https://github.com/tomchristie/django-rest-framework/milestones/3.2.3%20Release","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/milestones/30/labels","id":1253238,"number":30,"title":"3.2.3 Release","description":"","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":7,"closed_issues":1,"state":"open","created_at":"2015-08-13T09:05:32Z","updated_at":"2015-08-19T15:06:43Z","due_on":"2015-09-02T23:00:00Z","closed_at":null},"comments":7,"created_at":"2015-08-17T18:59:36Z","updated_at":"2015-08-20T08:36:41Z","closed_at":null,"body":"I was implementing some bare-bones custom pagination of sorts that worked fine in 3.1.3 but is now broken since updating to 3.2.0 (FWIW it's also broken in 3.2.2). If there was an API change, I haven't been able to find it in the code or the docs.  \r\n\r\nRelevant code snippets:  \r\n\r\nviews.py:\r\n```\r\nclass ListingSearchViewSet(viewsets.ModelViewSet):\r\n    serializer_class = serializers.ListingSerializer\r\n    filter_backends = (filters.SearchFilter, )\r\n    search_fields = ('title', 'description', 'description_short',)\r\n    pagination_class = None\r\n\r\ndef get_queryset(self):\r\n        filter_params = {}\r\n        limit = self.request.query_params.get('limit', False)\r\n        offset = self.request.query_params.get('offset', False)\r\n        if limit:\r\n            filter_params['limit'] = limit\r\n        if offset:\r\n            filter_params['offset'] = offset\r\n        return model_access.filter_listings(self.request.user.username,\r\n            filter_params)\r\n\r\n    def list(self, request):\r\n        return super(ListingSearchViewSet, self).list(self, request)\r\n```\r\nmodel_access.py:\r\n```\r\ndef filter_listings(username, filter_params):\r\n    objects = models.Listing.objects.for_user(username).all()\r\n    # enforce any pagination params\r\n    if 'offset' in filter_params:\r\n        offset = int(filter_params['offset'])\r\n        objects = objects[offset:]\r\n\r\n    if 'limit' in filter_params:\r\n        limit = int(filter_params['limit'])\r\n        objects = objects[:limit]\r\n    return objects\r\n```\r\n\r\nIn all versions since 3.1.3, I get the following error when invoking this endpoint: `AssertionError: Cannot create distinct fields once a slice has been taken.`. If I remove the line that does the limiting (`objects = objects[:limit]`), I don't get the assertion error. Offset seems to behave in a similar manner.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/comments/132938157","html_url":"https://github.com/tomchristie/django-rest-framework/issues/3284#issuecomment-132938157","issue_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3284","id":132938157,"user":{"login":"carltongibson","id":64686,"avatar_url":"https://avatars.githubusercontent.com/u/64686?v=3","gravatar_id":"","url":"https://api.github.com/users/carltongibson","html_url":"https://github.com/carltongibson","followers_url":"https://api.github.com/users/carltongibson/followers","following_url":"https://api.github.com/users/carltongibson/following{/other_user}","gists_url":"https://api.github.com/users/carltongibson/gists{/gist_id}","starred_url":"https://api.github.com/users/carltongibson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carltongibson/subscriptions","organizations_url":"https://api.github.com/users/carltongibson/orgs","repos_url":"https://api.github.com/users/carltongibson/repos","events_url":"https://api.github.com/users/carltongibson/events{/privacy}","received_events_url":"https://api.github.com/users/carltongibson/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T08:36:41Z","updated_at":"2015-08-20T08:36:41Z","body":"Entirely. (I think are \"_only_\"s are talking about different before/afters...) Anyhoooo... @arw180 what's your smallest reproduce case look like? "}}