def get_context_data(self, **kwargs): context = super().get_context_data() context.update({ 'dm_list': super().get_queryset(), 'mv_list': VideoInfo.get_type_video_list(VideoInfo.TYPE_MV)[:10], 'tv_list': VideoInfo.get_type_video_list(VideoInfo.TYPE_TV)[:10], 'zy_list': VideoInfo.get_type_video_list(VideoInfo.TYPE_ZY)[:10], 'ot_list': VideoInfo.get_type_video_list(VideoInfo.TYPE_OT)[:10], 'dm_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_DM)[:10], 'mv_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_MV)[:10], 'tv_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_TV)[:10], 'zy_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_ZY)[:10], 'ot_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_OT)[:10], 'links': Links.get_links() }) return context
class IndexView(CommonListView): queryset = VideoInfo.get_type_video_list(VideoInfo.TYPE_DM)[:10] context_object_name = 'video_list' template_name = 'video/index_list.html' def get_context_data(self, **kwargs): context = super().get_context_data() context.update({ 'dm_list': super().get_queryset(), 'mv_list': VideoInfo.get_type_video_list(VideoInfo.TYPE_MV)[:10], 'tv_list': VideoInfo.get_type_video_list(VideoInfo.TYPE_TV)[:10], 'zy_list': VideoInfo.get_type_video_list(VideoInfo.TYPE_ZY)[:10], 'ot_list': VideoInfo.get_type_video_list(VideoInfo.TYPE_OT)[:10], 'dm_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_DM)[:10], 'mv_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_MV)[:10], 'tv_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_TV)[:10], 'zy_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_ZY)[:10], 'ot_pv_list': VideoInfo.get_hot_video_list(VideoInfo.TYPE_OT)[:10], 'links': Links.get_links() }) return context
class CommonListView(CommonUserMixin, ListView): queryset = VideoInfo.latest_video() context_object_name = 'video_list' def get_context_data(self, **kwargs): context = super().get_context_data() context.update({'max_left_item_count': 2}) return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) name = VideoInfo.get_video_name(self.kwargs.get('video_id')) context.update({ 'video_links': VideoLink.get_video_links(name), 'links': Links.get_links(), }) return context
class VideoPlayIndexView(CommonPUView): queryset = VideoInfo.latest_video() context_object_name = 'video_play_index' template_name = 'video/playindex.html' pk_url_kwarg = 'video_id' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) name = VideoInfo.get_video_name(self.kwargs.get('video_id')) context.update({ 'video_links': VideoLink.get_video_links(name), 'links': Links.get_links(), }) return context
class VideoDetailView(CommonPUView): queryset = VideoInfo.latest_video() context_object_name = 'video_detail' template_name = 'video/detail.html' pk_url_kwarg = 'video_id' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) video_id = self.kwargs.get('video_id') name = VideoInfo.get_video_name(video_id) context.update({ 'video_links': VideoLink.get_video_links(name), 'links': Links.get_links(), }) return context
def get_queryset(self): request_path = str(self.request.path).replace('/', '') v_type = VideoInfo.V_TYPE_LIST[request_path] queryset = VideoInfo.get_type_video_list(v_type) return queryset