I now how to use django pagination with ORM django after filtering the required data and put in into
query=request.GET.get("q")
if query:
queryset_list=queryset_list.filter(
Q(name__icontains=query)|
Q(father_name__icontains=query)|
Q(mother_name__icontains=query)|
Q(content__icontains=query)|
Q(create_date__icontains=query)
# Q(user__first_name__contains=query)
).distinct()
paginator = Paginator(queryset_list, 5)
page_request_var = "page"
page = request.GET.get(page_request_var)
queryset = paginator.get_page(page)
context={
"object_list":queryset,
"title":"List Items",
"page_request_var":page_request_var,
}
return render(request,"blog/list.html", context)
i know that i must use LIMIT and OFFSET in raw SQL to embedded into paginator.