jamespacileo/django-pure-pagination

Sample code may be wrong

YiAnCN opened this issue · 5 comments

p = Paginator(objects, request=request) in views.py may need to add the number of paged pages,
That is modified as p = Paginator(objects, number, request=request)

Otherwise it will report this error: __init__() missing 1 required positional argument: 'per_page'

Ran into the same issue.

same here

any solution?

@harolCalzada
p = Paginator(objects, request=request)
Just add the number of pages you need to page in this line of code.

def HomeView(request): datas = Article.objects.all() all_post = Paginator(datas,3) page_number = request.GET.get('page') page_obj = Paginator.get_page(page_number) return render(request,'index.html',{'page_obj':page_obj})