﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34353	ListView paging property did not return	Liyifo	nobody	"
{{{
class ProductListView(ListView):
    template_name = 'product.html'
    model = Products
    paginate_by = 2
    context_object_name = 'products'

    def get_queryset(self):
        queryset = self.model.objects.all().filter(category_id=self.kwargs['pk'])
        return queryset

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['information'] = BaseInformation.objects.first()
        context['classification'] = ProductCategory.objects.all()
        context['news'] = News.objects.filter(is_top=True).filter(is_published=True)
        context['category'] = ProductCategory.objects.filter(pk=self.kwargs['pk']).first()
        print('****************')
        print(context)
        print(context['paginator'].__dict__)
        print(context['page_obj'].__dict__)
        return context
}}}

result：

{{{
****************
{'paginator': <django.core.paginator.Paginator object at 0x00000258B07A6E20>, 'page_obj': <Page 2 of 2>, 'is_paginated': True, 'object_list': <QuerySet 
[<Products: test3>]>, 'products': <QuerySet [<Products: test3>]>, 'view': <web.views.ProductListView object at 0x00000258B07A6F70>, 'information': <Base
Information: 公司基本信息>, 'classification': <QuerySet [<ProductCategory: 藤仓气缸经济型>, <ProductCategory: 接头、调速阀>, <ProductCategory: 藤仓专区>
]>, 'news': <QuerySet [<News: 1231231>, <News: 节日放假通知>]>, 'category': <ProductCategory: 藤仓气缸经济型>}
{'object_list': <QuerySet [<Products: test>, <Products: test2>, <Products: test3>]>, 'per_page': 2, 'orphans': 0, 'allow_empty_first_page': True, 'count
': 3, 'num_pages': 2}

}}}

docs[https://docs.djangoproject.com/zh-hans/4.1/topics/pagination/]
The ""page_obj. next_page_number"" and other attributes mentioned in the document do not exist

My web page returns results

{{{
href=""?page=<bound method Page.next_page_number of <Page 2 of 2>>""
}}}


"	Bug	closed	Generic views	4.1	Normal	invalid			Unreviewed	0	0	0	0	0	0
