context_object_name = 'posts'. The template default name is ListView 'object_list' from .models import Post,Category from django.views.generic.list import ListView from django.shortcuts import get_object_or_404 class PostCategory(ListView): model = P…
ListView (带分页) 1.带分页效果的基础模板 1) view from django.views.generic.list import ListView from employ.models import Company class CompanyListView(ListView): model = Company context_object_name = "companies" template_name = 'company/company_list.html' p…