- `{{created_day}}`: created day
- `{{created_time}}`: created time in HH:MM format
- `{{doc_url}}`: URL to the document in the web UI. Requires the `PAPERLESS_URL` setting to be set.
+- `{{doc_id}}`: Document ID
##### Examples
created: date | None = None,
doc_title: str | None = None,
doc_url: str | None = None,
+ doc_id: int | None = None,
) -> str:
"""
Available title placeholders for Workflows depend on what has already been assigned,
formatting.update({"doc_title": doc_title})
if doc_url is not None:
formatting.update({"doc_url": doc_url})
+ if doc_id is not None:
+ formatting.update({"doc_id": str(doc_id)})
logger.debug(f"Parsing Workflow Jinja template: {text}")
try:
)
webhook_action = WorkflowActionWebhook.objects.create(
use_params=False,
- body="Test message: {{doc_url}}",
+ body="Test message: {{doc_url}} with id {{doc_id}}",
url="http://paperless-ngx.com",
include_document=False,
)
mock_post.assert_called_once_with(
url="http://paperless-ngx.com",
- data=f"Test message: http://localhost:8000/paperless/documents/{doc.id}/",
+ data=(
+ f"Test message: http://localhost:8000/paperless/documents/{doc.id}/"
+ f" with id {doc.id}"
+ ),
headers={},
files=None,
as_json=False,
"current_filename": document.filename or "",
"added": timezone.localtime(document.added),
"created": document.created,
+ "id": document.pk,
}
correspondent_obj = (
"current_filename": filename,
"added": timezone.localtime(timezone.now()),
"created": overrides.created if overrides else None,
+ "id": "",
}
context["created"],
context["title"],
context["doc_url"],
+ context["id"],
)
if action.email.subject
else ""
context["created"],
context["title"],
context["doc_url"],
+ context["id"],
)
if action.email.body
else ""
context["created"],
context["title"],
context["doc_url"],
+ context["id"],
)
except Exception as e:
logger.error(
context["created"],
context["title"],
context["doc_url"],
+ context["id"],
)
headers = {}
if action.webhook.headers:
document.original_filename or "",
document.filename or "",
document.created,
+ "", # dont pass the title to avoid recursion
+ "", # no urls in titles
+ document.pk,
)
except Exception: # pragma: no cover
logger.exception(