Remove: old serve_submission_file view func
This commit is contained in:
parent
4c43e6a5c5
commit
fcee63998e
1 changed files with 0 additions and 24 deletions
|
@ -32,30 +32,6 @@ def compute_file_hash(file):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@login_required(login_url="/login/")
|
|
||||||
def serve_submission_file(request, file_hash):
|
|
||||||
'''
|
|
||||||
View function to serve submission files for download or inline viewing
|
|
||||||
'''
|
|
||||||
download = request.GET.get('d')
|
|
||||||
|
|
||||||
try:
|
|
||||||
submission_file = get_object_or_404(Submission_File, file_hash=file_hash)
|
|
||||||
file = submission_file.file.file
|
|
||||||
file_name = submission_file.file_name
|
|
||||||
|
|
||||||
response = FileResponse(file)
|
|
||||||
if download == "1":
|
|
||||||
response['Content-Disposition'] = f'attachment; filename="{file_name}"'
|
|
||||||
else:
|
|
||||||
response['Content-Disposition'] = f'inline; filename="{file_name}"'
|
|
||||||
|
|
||||||
return response
|
|
||||||
|
|
||||||
except:
|
|
||||||
return HttpResponse("File not found", status=404)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required(login_url="/login/")
|
@login_required(login_url="/login/")
|
||||||
def serve_content_file(request, folder, file_hash):
|
def serve_content_file(request, folder, file_hash):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue