Skip to content

Instantly share code, notes, and snippets.

@abcsun
Created March 6, 2019 03:23
Show Gist options
  • Save abcsun/bd8d200d2b1dd6c2928518e3e8dc9938 to your computer and use it in GitHub Desktop.
Save abcsun/bd8d200d2b1dd6c2928518e3e8dc9938 to your computer and use it in GitHub Desktop.
pagination for DRF
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)
@abcsun
Copy link
Author

abcsun commented May 8, 2019

resp = self.get_paginated_response(cars.data)
data = resp.data
data['title'] = ClientMessage.get_wording('OTHER_CARS', name=g.user.display_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment