Created
March 6, 2019 03:23
-
-
Save abcsun/bd8d200d2b1dd6c2928518e3e8dc9938 to your computer and use it in GitHub Desktop.
pagination for DRF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
queryset = Garage.objects.filter(user=user).exclude(status=Garage.TEMPLATE).order_by("-created_at") | |
page = self.paginate_queryset(queryset) | |
serializer = GarageViewSerializer(page, many=True) | |
return self.get_paginated_response(serializer.data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
resp = self.get_paginated_response(cars.data)
data = resp.data
data['title'] = ClientMessage.get_wording('OTHER_CARS', name=g.user.display_name)