mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Ensure filling in "none" when a tag has not been found
This commit is contained in:
parent
1e102efaf8
commit
1ce94348d8
@ -326,6 +326,8 @@ class Document(models.Model):
|
|||||||
def generate_source_filename(self):
|
def generate_source_filename(self):
|
||||||
# Create filename based on configured format
|
# Create filename based on configured format
|
||||||
if settings.PAPERLESS_FILENAME_FORMAT is not None:
|
if settings.PAPERLESS_FILENAME_FORMAT is not None:
|
||||||
|
tag = defaultdict(lambda: slugify(None),
|
||||||
|
self.many_to_dictionary(self.tags))
|
||||||
list_length = 10
|
list_length = 10
|
||||||
tags = self.many_to_list(self.tags)
|
tags = self.many_to_list(self.tags)
|
||||||
while True:
|
while True:
|
||||||
@ -336,7 +338,7 @@ class Document(models.Model):
|
|||||||
title=slugify(self.title),
|
title=slugify(self.title),
|
||||||
created=slugify(self.created),
|
created=slugify(self.created),
|
||||||
added=slugify(self.added),
|
added=slugify(self.added),
|
||||||
tag=defaultdict(str, self.many_to_dictionary(self.tags)),
|
tag=tag,
|
||||||
tags=tags)
|
tags=tags)
|
||||||
break
|
break
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
@ -206,7 +206,7 @@ class TestDate(TestCase):
|
|||||||
# Ensure that filename is properly generated
|
# Ensure that filename is properly generated
|
||||||
tmp = document.source_filename
|
tmp = document.source_filename
|
||||||
self.assertEqual(document.generate_source_filename(),
|
self.assertEqual(document.generate_source_filename(),
|
||||||
"0000001.pdf")
|
"none-0000001.pdf")
|
||||||
document.create_source_directory()
|
document.create_source_directory()
|
||||||
Path(document.source_path).touch()
|
Path(document.source_path).touch()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user