paperap.resources.custom_fields module
Module for managing custom field resources in the Paperless-NgX API.
This module provides the CustomFieldResource class which encapsulates all interactions with custom fields in a Paperless-NgX system. It leverages the underlying StandardResource functionality to provide CRUD operations, filtering, and other specialized behaviors for custom field management.
Custom fields allow users to define additional metadata fields for documents beyond the standard fields provided by Paperless-NgX. These fields can be of various data types including string, integer, boolean, date, etc.
Example
>>> custom_field = client.custom_fields.create(name="Priority", data_type="string")
>>> print(f"Created field ID: {custom_field.id}")
- class paperap.resources.custom_fields.CustomFieldResource(client)[source]
Bases:
StandardResource
[CustomField
,CustomFieldQuerySet
]CustomFieldResource handles operations related to custom fields in the Paperless-NgX API.
This resource class extends the StandardResource to provide CRUD operations, robust filtering, and other specialized methods for managing custom fields, allowing users to define, update, and remove custom metadata on documents.
- Custom fields can be of various data types including:
string: Text values
integer: Numeric values
boolean: True/False values
date: Date values (ISO format)
monetary: Currency values
url: Web addresses
- model_class
The model class representing a custom field.
- Type:
Type[CustomField]
- queryset_class
The queryset class for handling lists of custom field models.
- Type:
Type[CustomFieldQuerySet]
Example
>>> # Create a new custom field >>> date_field = client.custom_fields.create( ... name="Due Date", ... data_type="date" ... ) >>> # Get all custom fields >>> all_fields = client.custom_fields.all() >>> # Get a specific custom field >>> field = client.custom_fields.get(1) >>> # Update a custom field >>> field.name = "Updated Name" >>> field.save()
- Parameters:
client (PaperlessClient)
- model_class
alias of
CustomField
- queryset_class
alias of
CustomFieldQuerySet
- name: str = 'custom_fields'
- endpoints: ClassVar[Endpoints] = {'create': <string.Template object>, 'delete': <string.Template object>, 'detail': <string.Template object>, 'list': <string.Template object>, 'update': <string.Template object>}