|
|
|
@ -285,11 +285,15 @@ def videoView(request, id): |
|
|
|
|
return render(request, 'nav/videoview.html', {'path': data.video_path}) |
|
|
|
|
|
|
|
|
|
def videoList(request): |
|
|
|
|
video_type = request.GET.get('video_type', '全部内容') |
|
|
|
|
if video_type == '全部内容': |
|
|
|
|
data = videoUpload.objects.all().order_by('video_title', '-video_time') |
|
|
|
|
else: |
|
|
|
|
data = videoUpload.objects.filter(video_desc=video_type).all().order_by('video_title','-video_time') |
|
|
|
|
desc = videoUpload.objects.all().values('video_desc').distinct() |
|
|
|
|
data = {} |
|
|
|
|
for i in desc: |
|
|
|
|
data[i["video_desc"]] = videoUpload.objects.filter(video_desc=i["video_desc"]).all().order_by('video_title') |
|
|
|
|
return render(request, 'nav/videolist.html', {'data':data }) |
|
|
|
|
desc = [i['video_desc'] for i in desc] |
|
|
|
|
desc.append('全部内容') |
|
|
|
|
return render(request, 'nav/videolist.html', {'data': data, 'desc': desc, 'selected': video_type}) |
|
|
|
|
|
|
|
|
|
def file_iterator(file_name, chunk_size=8192, offset=0, length=None): |
|
|
|
|
with open(file_name, "rb") as f: |
|
|
|
@ -340,5 +344,5 @@ def videoDownload(request, id): |
|
|
|
|
response = FileResponse(file) |
|
|
|
|
response['Content-Type'] = 'application/octet-stream' |
|
|
|
|
response['Content-Disposition'] = 'attachment;filename="{}"'.format(quote(file_name)) |
|
|
|
|
messages.error(request, '下载成功') |
|
|
|
|
#messages.error(request, '下载成功') |
|
|
|
|
return response |
|
|
|
|