How do I use pagination in Django when I apply filters in a class-based view. the URL always keeps changing how can I track the URL to go to the next page. can anyone help me
Asked
Active
Viewed 41 times
1 Answers
0
You can use django rest framework inbuilt pagination classes.
https://www.django-rest-framework.org/api-guide/pagination/
Personally I use PageNumberPagination . The result also returns the link of the next and previous pages along with the total count.
Alternatively, you can use LimitOffsetPagination. This one is more flexible as compared to PageNumberPagination because the offset and limit can be manipulated from the URL. This is more suitable to the case when the front end has a feature to change the page size.

Anuj Gupta
- 576
- 5
- 9