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
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