Dont tag files that aren't PDFs
This commit is contained in:
parent
95ee92cef6
commit
f1757be96e
@ -334,6 +334,7 @@ class WorkAddDocumentView(CollectionMixin, CreateView):
|
|||||||
# auto tag the document
|
# auto tag the document
|
||||||
|
|
||||||
#name, ext = os.path.splitext(os.path.basename(doc.upload.name))
|
#name, ext = os.path.splitext(os.path.basename(doc.upload.name))
|
||||||
|
if doc.doctype == models.Document.DOCTYPE_PDF:
|
||||||
parts = re.split(r'[^A-Za-z]+', orig_name)
|
parts = re.split(r'[^A-Za-z]+', orig_name)
|
||||||
parts.reverse()
|
parts.reverse()
|
||||||
for word in parts:
|
for word in parts:
|
||||||
@ -344,8 +345,6 @@ class WorkAddDocumentView(CollectionMixin, CreateView):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if self.request.headers['Accept'] == 'application/json':
|
if self.request.headers['Accept'] == 'application/json':
|
||||||
filename = os.path.basename(doc.upload.name)
|
filename = os.path.basename(doc.upload.name)
|
||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user