From 88c23ecc15abb9e7b0532424b3ffe9e07c215233 Mon Sep 17 00:00:00 2001 From: Freddy0 <72572280+Freddy-0@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:59:58 +0200 Subject: [PATCH] Added owner name to post consume env --- docs/advanced_usage.md | 1 + scripts/post-consumption-example.sh | 1 + src/documents/consumer.py | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/advanced_usage.md b/docs/advanced_usage.md index 0a8c2972f..0215ca510 100644 --- a/docs/advanced_usage.md +++ b/docs/advanced_usage.md @@ -187,6 +187,7 @@ variables: | `DOCUMENT_THUMBNAIL_PATH` | Path to the generated thumbnail | | `DOCUMENT_DOWNLOAD_URL` | URL for document download | | `DOCUMENT_THUMBNAIL_URL` | URL for the document thumbnail | +| `DOCUMENT_OWNER` | Name of the owner of the document | | `DOCUMENT_CORRESPONDENT` | Assigned correspondent (if any) | | `DOCUMENT_TAGS` | Comma separated list of tags applied (if any) | | `DOCUMENT_ORIGINAL_FILENAME` | Filename of original document | diff --git a/scripts/post-consumption-example.sh b/scripts/post-consumption-example.sh index 6e42b1bc3..154f9df71 100755 --- a/scripts/post-consumption-example.sh +++ b/scripts/post-consumption-example.sh @@ -14,6 +14,7 @@ following additional information about it: * Thumbnail Path: ${DOCUMENT_THUMBNAIL_PATH} * Download URL: ${DOCUMENT_DOWNLOAD_URL} * Thumbnail URL: ${DOCUMENT_THUMBNAIL_URL} +* Owner Name: ${DOCUMENT_OWNER} * Correspondent: ${DOCUMENT_CORRESPONDENT} * Tags: ${DOCUMENT_TAGS} diff --git a/src/documents/consumer.py b/src/documents/consumer.py index d061a4352..cbccde28c 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -450,6 +450,7 @@ class ConsumerPlugin( "document-thumb", kwargs={"pk": document.pk}, ) + script_env["DOCUMENT_OWNER"] = str(document.owner) script_env["DOCUMENT_CORRESPONDENT"] = str(document.correspondent) script_env["DOCUMENT_TAGS"] = str( ",".join(document.tags.all().values_list("name", flat=True)),