我的代码是这样的:我自定义了我的上下文并想访问我在模板中设置的查询
class GetStudentQueryHandler(ListView):
template_name = 'client.html'
paginate_by = STUDENT_PER_PAGE
context_object_name = 'studentinfo'
def get_context_data(self, **kwargs):
context = super(GetStudentQueryHandler, self).get_context_data(**kwargs)
context['can_show_distribute'] = self.request.user.has_perm('can_show_distribute_page')
context['form'] = QueryStudentForm
return context
def get_queryset(self):
问题是:如何访问模板中 get_queryset 方法返回的查询集?我知道我可以访问诸如 studentinfo.can_show_distribute 之类的自定义属性,如何访问查询数据?