paperap.models.workflow.queryset module
Provide specialized querysets for interacting with Paperless-NGX workflow resources.
This module contains queryset implementations for workflows, workflow actions, and workflow triggers. Each queryset extends the standard queryset functionality with specialized filtering methods specific to workflow-related resources.
- class paperap.models.workflow.queryset.WorkflowQuerySet(resource, filters=None, _cache=None, _fetch_all=False, _next_url=None, _last_response=None, _iter=None, _urls_fetched=None)[source]
Bases:
StandardQuerySet
[Workflow]Specialized queryset for interacting with Paperless-NGX workflows.
Extends StandardQuerySet to provide workflow-specific filtering methods, making it easier to query workflows by attributes such as name, order, and enabled status. The queryset is lazy-loaded, meaning API requests are only made when data is actually needed.
Examples
- Get all enabled workflows:
>>> enabled_workflows = client.workflows.filter(enabled=True) >>> # Or using the specialized method >>> enabled_workflows = client.workflows.enabled()
- Filter workflows by name:
>>> tax_workflows = client.workflows.name("tax")
- Parameters:
resource (BaseResource[_Model, Self])
filters (dict[str, Any] | None)
_cache (list[_Model] | None)
_fetch_all (bool)
_next_url (str | None)
_last_response (ClientResponse)
_iter (Iterator[_Model] | None)
_urls_fetched (list[str] | None)
- name(value, *, exact=True, case_insensitive=True)[source]
Filter workflows by name.
- Parameters:
- Return type:
Self
- Returns:
A filtered WorkflowQuerySet containing matching workflows.
Examples
- Find workflows with exact name:
>>> invoice_workflows = client.workflows.name("Invoice Processing")
- Find workflows containing a string (case-insensitive):
>>> invoice_workflows = client.workflows.name("invoice", exact=False)
- order(value)[source]
Filter workflows by their execution order.
Paperless-NGX workflows have an order value that determines their execution sequence. This method finds workflows with a specific order value.
- Parameters:
value (
int
) – The order value to filter by.- Return type:
Self
- Returns:
A filtered WorkflowQuerySet containing workflows with the specified order.
- enabled(value=True)[source]
Filter workflows by their enabled status.
- Parameters:
value (
bool
) – If True, return only enabled workflows; if False, return only disabled workflows.- Return type:
Self
- Returns:
A filtered WorkflowQuerySet containing workflows with the specified enabled status.
Examples
- Get all enabled workflows:
>>> active_workflows = client.workflows.enabled()
- Get all disabled workflows:
>>> inactive_workflows = client.workflows.enabled(False)
- class paperap.models.workflow.queryset.WorkflowActionQuerySet(resource, filters=None, _cache=None, _fetch_all=False, _next_url=None, _last_response=None, _iter=None, _urls_fetched=None)[source]
Bases:
StandardQuerySet
[WorkflowAction]Specialized queryset for interacting with Paperless-NGX workflow actions.
Extends StandardQuerySet to provide workflow action-specific filtering methods, making it easier to query actions by attributes such as type and assigned metadata. Workflow actions define what happens when a workflow is triggered, such as assigning tags, correspondents, or document types to documents.
Examples
- Get actions that assign a specific tag:
>>> tag_actions = client.workflow_actions.assign_tags(5)
- Find actions that set a specific title:
>>> title_actions = client.workflow_actions.assign_title("Invoice")
- Parameters:
resource (BaseResource[_Model, Self])
filters (dict[str, Any] | None)
_cache (list[_Model] | None)
_fetch_all (bool)
_next_url (str | None)
_last_response (ClientResponse)
_iter (Iterator[_Model] | None)
_urls_fetched (list[str] | None)
- type(value, *, exact=True, case_insensitive=True)[source]
Filter workflow actions by their type.
Workflow actions in Paperless-NGX have different types that determine what they do (e.g., assign metadata, move document, etc.).
- Parameters:
- Return type:
Self
- Returns:
A filtered WorkflowActionQuerySet containing actions of the specified type.
Examples
- Find all actions that assign metadata:
>>> assign_actions = client.workflow_actions.type("assign")
- assign_title(value, *, exact=True, case_insensitive=True)[source]
Filter workflow actions by the title they assign to documents.
Find workflow actions that set a specific document title when triggered.
- Parameters:
- Return type:
Self
- Returns:
A filtered WorkflowActionQuerySet containing actions that assign the specified title.
Examples
- Find actions that set titles containing “Invoice”:
>>> invoice_actions = client.workflow_actions.assign_title("Invoice", exact=False)
- assign_tags(value)[source]
Filter workflow actions by the tags they assign to documents.
Find workflow actions that assign specific tags to documents when triggered. Can filter by a single tag ID or multiple tag IDs.
- Parameters:
value (
int
|list
[int
]) – The tag ID or list of tag IDs to filter by.- Return type:
Self
- Returns:
A filtered WorkflowActionQuerySet containing actions that assign the specified tags.
Examples
- Find actions that assign a specific tag:
>>> tax_tag_actions = client.workflow_actions.assign_tags(5)
- Find actions that assign any of several tags:
>>> financial_tag_actions = client.workflow_actions.assign_tags([5, 8, 12])
- assign_correspondent(value)[source]
Filter workflow actions by the correspondent they assign to documents.
Find workflow actions that assign a specific correspondent to documents when triggered.
- Parameters:
value (
int
) – The correspondent ID to filter by.- Return type:
Self
- Returns:
A filtered WorkflowActionQuerySet containing actions that assign the specified correspondent.
Examples
- Find actions that assign a specific correspondent:
>>> vendor_actions = client.workflow_actions.assign_correspondent(3)
- assign_document_type(value)[source]
Filter workflow actions by the document type they assign.
Find workflow actions that assign a specific document type to documents when triggered.
- Parameters:
value (
int
) – The document type ID to filter by.- Return type:
Self
- Returns:
A filtered WorkflowActionQuerySet containing actions that assign the specified document type.
Examples
- Find actions that assign a specific document type:
>>> invoice_type_actions = client.workflow_actions.assign_document_type(2)
- assign_storage_path(value)[source]
Filter workflow actions by the storage path they assign to documents.
Find workflow actions that assign a specific storage path to documents when triggered.
- Parameters:
value (
int
) – The storage path ID to filter by.- Return type:
Self
- Returns:
A filtered WorkflowActionQuerySet containing actions that assign the specified storage path.
Examples
- Find actions that assign a specific storage path:
>>> tax_path_actions = client.workflow_actions.assign_storage_path(4)
- assign_owner(value)[source]
Filter workflow actions by the owner they assign to documents.
Find workflow actions that assign a specific owner (user) to documents when triggered.
- Parameters:
value (
int
) – The owner (user) ID to filter by.- Return type:
Self
- Returns:
A filtered WorkflowActionQuerySet containing actions that assign the specified owner.
Examples
- Find actions that assign documents to a specific user:
>>> admin_actions = client.workflow_actions.assign_owner(1)
- class paperap.models.workflow.queryset.WorkflowTriggerQuerySet(resource, filters=None, _cache=None, _fetch_all=False, _next_url=None, _last_response=None, _iter=None, _urls_fetched=None)[source]
Bases:
StandardQuerySet
[WorkflowTrigger]Specialized queryset for interacting with Paperless-NGX workflow triggers.
Extends StandardQuerySet to provide workflow trigger-specific filtering methods, making it easier to query triggers by attributes such as type and filter conditions. Workflow triggers define when a workflow should be executed, such as when a document is added with specific attributes or matches certain criteria.
Examples
- Get all triggers of a specific type:
>>> consumption_triggers = client.workflow_triggers.type(1) # Type 1 might be "document added"
- Find triggers that look for specific tags:
>>> tax_triggers = client.workflow_triggers.has_tags(5) # Tag ID 5 might be "Tax"
- Parameters:
resource (BaseResource[_Model, Self])
filters (dict[str, Any] | None)
_cache (list[_Model] | None)
_fetch_all (bool)
_next_url (str | None)
_last_response (ClientResponse)
_iter (Iterator[_Model] | None)
_urls_fetched (list[str] | None)
- type(value)[source]
Filter workflow triggers by their type.
Workflow triggers in Paperless-NGX have different types that determine when they activate (e.g., document added, document consumed, etc.).
- Parameters:
value (
int
) – The trigger type ID to filter by.- Return type:
Self
- Returns:
A filtered WorkflowTriggerQuerySet containing triggers of the specified type.
Examples
- Find all triggers that activate when documents are consumed:
>>> consumption_triggers = client.workflow_triggers.type(1) # Assuming 1 is consumption type
- filter_path(value, *, exact=True, case_insensitive=True)[source]
Filter workflow triggers by their path filter condition.
Find workflow triggers that activate based on a document’s source path matching specific criteria.
- Parameters:
- Return type:
Self
- Returns:
A filtered WorkflowTriggerQuerySet containing triggers with the specified path filter.
Examples
- Find triggers that look for documents from a specific directory:
>>> inbox_triggers = client.workflow_triggers.filter_path("/inbox/")
- Find triggers that look for documents from any path containing a string:
>>> invoice_triggers = client.workflow_triggers.filter_path("invoices", exact=False)
- filter_filename(value, *, exact=True, case_insensitive=True)[source]
Filter workflow triggers by their filename filter condition.
Find workflow triggers that activate based on a document’s original filename matching specific criteria.
- Parameters:
- Return type:
Self
- Returns:
A filtered WorkflowTriggerQuerySet containing triggers with the specified filename filter.
Examples
- Find triggers that look for documents with specific text in filenames:
>>> invoice_triggers = client.workflow_triggers.filter_filename("invoice", exact=False)
- Find triggers that look for specific file types:
>>> pdf_triggers = client.workflow_triggers.filter_filename(".pdf", exact=False)
- filter_mailrule(value, *, exact=True, case_insensitive=True)[source]
Filter workflow triggers by their mail rule filter condition.
Find workflow triggers that activate based on a document’s associated mail rule matching specific criteria.
- Parameters:
- Return type:
Self
- Returns:
A filtered WorkflowTriggerQuerySet containing triggers with the specified mail rule filter.
Examples
- Find triggers that look for documents from a specific mail rule:
>>> vendor_mail_triggers = client.workflow_triggers.filter_mailrule("vendor@example.com")
- Find triggers that look for documents from mail rules containing specific text:
>>> invoice_mail_triggers = client.workflow_triggers.filter_mailrule("invoice", exact=False)
- has_tags(value)[source]
Filter workflow triggers by their tag filter condition.
Find workflow triggers that activate based on a document having specific tags. Can filter by a single tag ID or multiple tag IDs.
- Parameters:
value (
int
|list
[int
]) – The tag ID or list of tag IDs to filter by.- Return type:
Self
- Returns:
A filtered WorkflowTriggerQuerySet containing triggers with the specified tag filter.
Examples
- Find triggers that look for documents with a specific tag:
>>> tax_triggers = client.workflow_triggers.has_tags(5)
- Find triggers that look for documents with any of several tags:
>>> financial_triggers = client.workflow_triggers.has_tags([5, 8, 12])
- has_correspondent(value)[source]
Filter workflow triggers by their correspondent filter condition.
Find workflow triggers that activate based on a document having a specific correspondent.
- Parameters:
value (
int
) – The correspondent ID to filter by.- Return type:
Self
- Returns:
A filtered WorkflowTriggerQuerySet containing triggers with the specified correspondent filter.
Examples
- Find triggers that look for documents from a specific correspondent:
>>> vendor_triggers = client.workflow_triggers.has_correspondent(3)
- has_document_type(value)[source]
Filter workflow triggers by their document type filter condition.
Find workflow triggers that activate based on a document having a specific document type.
- Parameters:
value (
int
) – The document type ID to filter by.- Return type:
Self
- Returns:
A filtered WorkflowTriggerQuerySet containing triggers with the specified document type filter.
Examples
- Find triggers that look for documents of a specific type:
>>> invoice_triggers = client.workflow_triggers.has_document_type(2)