Python 基于django类的视图中的多重分页

Python 基于django类的视图中的多重分页,python,django,pagination,django-views,django-class-based-views,Python,Django,Pagination,Django Views,Django Class Based Views,下面的代码对查询集进行分页,但如何对上下文['guser1'进行分页 class AuthorList(ListView): template_name = 'authorList.html' paginate_by = 10 queryset = Author.objects.order_by('date') def get_context_data(self, **kwargs): context = super(AuthorList, self).get_

下面的代码对查询集进行分页,但如何对上下文['guser1'进行分页

class AuthorList(ListView):
    template_name = 'authorList.html'
    paginate_by = 10
    queryset = Author.objects.order_by('date')

def get_context_data(self, **kwargs):
    context = super(AuthorList, self).get_context_data(**kwargs)
    if int(self.kwargs['user_id']) != self.request.user.id:
        raise PermissionDenied
    if self.request.user.username == 'guest':
        raise PermissionDenied
    context['guser1'] = Author.objects.order_by('date').filter(
                 real_date__lte=datetime.now()).filter(
                 created_by=int(self.kwargs['user_id']))

    context['guser'] = User.objects.filter(pk=int(self.kwargs['user_id']))
    return context

如果您按
pk
进行筛选,则
User
查询集将只包含一个条目(或根本不包含条目),因此不清楚您为什么要对其进行分页。更新代码,我正试图使其变得如此简单。