paperap.models.document_type.model module


METADATA:

File: document_type.py

Project: paperap

Created: 2025-03-04

Version: 0.0.9

Author: Jess Mann Email: jess@jmann.me

Copyright (c) 2025 Jess Mann


LAST MODIFIED:

2025-03-04 By Jess Mann

class paperap.models.document_type.model.DocumentType(**data)[source]

Bases: StandardModel, MatcherMixin

Represents a document type in Paperless-NgX.

name

The name of the document type.

slug

A unique identifier for the document type.

match

The pattern used for matching documents.

matching_algorithm

The algorithm used for matching.

is_insensitive

Whether the matching is case insensitive.

document_count

The number of documents of this type.

owner

The owner of the document type.

user_can_change

Whether the user can change the document type.

Returns:

A new instance of DocumentType.

Examples

# Create a new DocumentType instance doc_type = DocumentType(name=”Invoice”, slug=”invoice”, match=”INV-*”)

Parameters:

data (Any)

name: str
slug: str | None
document_count: int
owner: int | None
user_can_change: bool | None
class Meta(model)[source]

Bases: Meta

Parameters:

model (type[_Self])

read_only_fields: ClassVar[set[str]] = {'document_count', 'id', 'slug'}
queryset

alias of DocumentTypeQuerySet

blacklist_filtering_params: ClassVar[set[str]] = {}
field_map: dict[str, str] = {}
filtering_disabled: ClassVar[set[str]] = {}
filtering_fields: ClassVar[set[str]] = {'_resource', 'document_count', 'id', 'name', 'owner', 'slug', 'user_can_change'}
supported_filtering_params: ClassVar[set[str]] = {'id', 'id__in', 'limit'}
model: type[_Self]
name: str
property documents: DocumentQuerySet

Get documents with this document type.

Returns:

A DocumentQuerySet containing documents of this type.

Examples

# Get all documents of this type documents = doc_type.documents

Get documents with this document type.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'ignore', 'populate_by_name': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

Parameters:
Return type:

None

id: int