mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-09 16:25:33 +01:00
Add 'doc_pk' to PAPERLESS_FILENAME_FORMAT handling (#3861)
* Add 'doc_pk' to PAPERLESS_FILENAME_FORMAT handling * Add test for 'doc_pk' filename formatter
This commit is contained in:
parent
b715e4d426
commit
6ad3d45d60
3 changed files with 15 additions and 0 deletions
|
|
@ -446,6 +446,19 @@ class TestFileHandling(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
|||
self.assertIsNotDir(os.path.join(settings.ORIGINALS_DIR, "none"))
|
||||
self.assertIsDir(settings.ORIGINALS_DIR)
|
||||
|
||||
@override_settings(FILENAME_FORMAT="{doc_pk}")
|
||||
def test_format_doc_pk(self):
|
||||
document = Document()
|
||||
document.pk = 1
|
||||
document.mime_type = "application/pdf"
|
||||
document.storage_type = Document.STORAGE_TYPE_UNENCRYPTED
|
||||
|
||||
self.assertEqual(generate_filename(document), "0000001.pdf")
|
||||
|
||||
document.pk = 13579
|
||||
|
||||
self.assertEqual(generate_filename(document), "0013579.pdf")
|
||||
|
||||
@override_settings(FILENAME_FORMAT=None)
|
||||
def test_format_none(self):
|
||||
document = Document()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue