#18 File upload in certain folders
* increases max_size for FileFields --> triggers when the file name will be automatically changed during upload * adds Http404 Exception in case document file does not exist anymore on the hard drive
This commit is contained in:
@@ -5,7 +5,7 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 01.09.21
|
||||
|
||||
"""
|
||||
from django.http import FileResponse, HttpRequest
|
||||
from django.http import FileResponse, HttpRequest, HttpResponse, Http404
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from konova.forms import RemoveModalForm
|
||||
@@ -22,7 +22,10 @@ def get_document(doc: AbstractDocument):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
return FileResponse(doc.file, as_attachment=True)
|
||||
try:
|
||||
return FileResponse(doc.file, as_attachment=True)
|
||||
except FileNotFoundError:
|
||||
raise Http404()
|
||||
|
||||
|
||||
def remove_document(request: HttpRequest, doc: AbstractDocument):
|
||||
|
||||
Reference in New Issue
Block a user