If for instance, my Django table has hundreds of rows and initially, in a view, I fetch first 10 records in the following format to be displayed on a webpage.
def fetchtExperts(request):
if request.method == "GET":
experts = Experts.objects.exclude(client_assigned=None).values('id', 'name', 'age').order_by('qualification')[:10]
return render(request, 'index.html', {'experts': experts})
If these 10 records are displayed on page 1, I want the next 10 records to be displayed when the user clicks on page 2. How do I fetch the next 10 records starting from the record succeeding the last fetched record? Do I send page 1's last record's ID to the view so that I could fetch the next 10 records accordingly or is there some better approach to achieve this?