mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-05-03 13:15:25 +00:00
Enhancement: add version label filename placeholder (#12185)
* Enhancement: add version label filename placeholder * fix test * add workflow placeholder * docs and missing version_label * typo * fix consume placeholder * update docs * Apply suggestion from @shamoon * fix None value --------- Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
@@ -113,6 +113,7 @@ def create_dummy_document():
|
||||
archive_filename="/dummy/archive_filename.pdf",
|
||||
original_filename="original_file.pdf",
|
||||
archive_serial_number=12345,
|
||||
version_label="Version #1",
|
||||
)
|
||||
return dummy_doc
|
||||
|
||||
@@ -189,6 +190,12 @@ def get_basic_metadata_context(
|
||||
if document.original_filename
|
||||
else no_value_default,
|
||||
"doc_pk": f"{document.pk:07}",
|
||||
"version_label": pathvalidate.sanitize_filename(
|
||||
document.version_label,
|
||||
replacement_text="-",
|
||||
)
|
||||
if document.version_label
|
||||
else no_value_default,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ def parse_w_workflow_placeholders(
|
||||
doc_title: str | None = None,
|
||||
doc_url: str | None = None,
|
||||
doc_id: int | None = None,
|
||||
version_label: str | None = None,
|
||||
) -> str:
|
||||
"""
|
||||
Available title placeholders for Workflows depend on what has already been assigned,
|
||||
@@ -62,6 +63,7 @@ def parse_w_workflow_placeholders(
|
||||
"owner_username": owner_username,
|
||||
"original_filename": Path(original_filename).stem,
|
||||
"filename": Path(filename).stem,
|
||||
"version_label": version_label or "",
|
||||
}
|
||||
if created is not None:
|
||||
formatting.update(
|
||||
|
||||
Reference in New Issue
Block a user