class MessagePagination(PageNumberPagination):
page_size = 10
page_size_query_param = 'page_size'
path(“api/messages/list/<int:page_number>“, views.your_view, name=“messages”)
def your_view(request, page_number)
messages = Paginator(queryset, 10)
return render(request, ‘template.html’, {‘messages’: get_page(page_number)})
<a href=“{% url ‘messages’ messages.next_page_number %}”>next page</a>