Dont tag files that aren't PDFs
This commit is contained in:
parent
95ee92cef6
commit
f1757be96e
@ -334,17 +334,16 @@ 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))
|
||||||
parts = re.split(r'[^A-Za-z]+', orig_name)
|
if doc.doctype == models.Document.DOCTYPE_PDF:
|
||||||
parts.reverse()
|
parts = re.split(r'[^A-Za-z]+', orig_name)
|
||||||
for word in parts:
|
parts.reverse()
|
||||||
try:
|
for word in parts:
|
||||||
tag = MUSIC_TAG_BY_NAME[word.lower()]
|
try:
|
||||||
doc.sections.create(tag=tag)
|
tag = MUSIC_TAG_BY_NAME[word.lower()]
|
||||||
break
|
doc.sections.create(tag=tag)
|
||||||
except KeyError:
|
break
|
||||||
pass
|
except KeyError:
|
||||||
|
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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user