问题
The code below paginates the queryset but how can I paginate context['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
来源:https://stackoverflow.com/questions/24336284/multiple-pagination-in-django-class-based-view