示例#1
0
 def get_context_data(self, *, object_list=None, **kwargs):
     context = super(LikeListView, self).get_context_data(**kwargs)
     paginator = context.get('paginator')
     page = context.get('page_obj')
     page_list = get_page_list(paginator, page)
     context['page_list'] = page_list
     return context
示例#2
0
 def get_context_data(self, *, object_list=None, **kwargs):
     context = super(SearchListView, self).get_context_data(**kwargs)
     paginator = context.get('paginator')  # 返回的是分页对象
     page = context.get('page_obj')  # 返回当前页码
     page_list = get_page_list(paginator, page)
     context['page_list'] = page_list
     context['q'] = self.q  # 搜索的关键字
     return context
示例#3
0
 def get_context_data(self, *, object_list=None, **kwargs):
     context = super(ClassificationListView,
                     self).get_context_data(**kwargs)
     paginator = context.get('paginator')
     page = context.get('page_obj')
     page_list = get_page_list(paginator, page)
     context['page_list'] = page_list
     context['q'] = self.q
     return context
示例#4
0
 def get_context_data(self, *, object_list=None, **kwargs):
     context = super(SearchView, self).get_context_data(**kwargs)
     paginator = context.get('paginator')
     page = context.get('page_obj')
     page_list = get_page_list(paginator, page)
     context['page_list'] = page_list
     context['q'] = self.q
     context['duration'] = round(self.duration, 6)
     context['record_count'] = self.record_count
     return context
示例#5
0
 def get_context_data(self, *, object_list=None, **kwargs):
     context = super(IndexView, self).get_context_data(**kwargs)
     paginator = context.get('paginator')
     page = context.get('page_obj')
     page_list = get_page_list(paginator, page)
     classification_list = Classification.objects.filter(status=True).values()
     context['c'] = self.c
     context['classification_list'] = classification_list
     context['page_list'] = page_list
     return context
示例#6
0
 def get_context_data(self, *, object_list=None, **kwargs):
     '''
     传递了分页数据
     :param object_list:
     :param kwargs:
     :return:
     '''
     context = super(FeedbackListView, self).get_context_data(**kwargs)
     paginator = context.get('paginator')
     page = context.get('page_obj')
     page_list = get_page_list(paginator, page)  # 分页器
     context['page_list'] = page_list
     context['q'] = self.q
     return context
示例#7
0
 def get_context_data(self, *, object_list=None, **kwargs):
     '''
     实现分页功能
     :param object_list:
     :param kwargs:
     :return:
     '''
     context = super(CommentListView, self).get_context_data(**kwargs)
     paginator = context.get('paginator')
     page = context.get('page_obj')
     page_list = get_page_list(paginator, page)
     context['page_list'] = page_list
     context['q'] = self.q
     return context
示例#8
0
 def get_context_data(self,
                      *,
                      object_list=None,
                      **kwargs):  # 重载get_context_data方法
     '''
     现在的分类id,视频分类并不属于Video模型.如果你想把分类id和视频分类传递给模板,你还可以通过重写get_context_data方法
     :param object_list:
     :param kwargs:
     :return:
     '''
     context = super(IndexView, self).get_context_data(**kwargs)
     paginator = context.get(
         'paginator')  # context.get(‘paginator’)返回的是分页对象,分页器
     page = context.get('page_obj')  # context.get(‘page_obj’)返回的是当前页码
     page_list = get_page_list(paginator, page)  # 处理分页
     #  将分类数据通过Classification.objects.filter(status=True).values()从数据库里面过滤出来,
     classification_list = Classification.objects.filter(
         status=True).values()  # 获取分类列表
     context['c'] = self.c  # 为分类的id
     # 然后赋给classification_list,最后放到context字典里面.
     context['classification_list'] = classification_list
     context['page_list'] = page_list
     return context