paperap.models.saved_view.model module

Saved View Model Module.

This module defines the SavedView model class, which represents saved views in Paperless-NgX. Saved views store filter configurations, display settings, and other view preferences that users can save and reuse.

class paperap.models.saved_view.model.SavedView(**data)[source]

Bases: StandardModel

Represents a saved view configuration in Paperless-NgX.

A saved view stores filter rules, sorting preferences, display settings, and other view configuration that can be saved and reused. Saved views can appear on the dashboard and/or sidebar for quick access.

name

The display name of the saved view.

show_on_dashboard

Whether this view should be shown on the dashboard.

show_in_sidebar

Whether this view should be shown in the sidebar.

sort_field

The field to sort results by (e.g., “created”, “title”).

sort_reverse

Whether to sort in reverse/descending order.

filter_rules

List of filter rules to apply to documents.

page_size

Number of documents to show per page.

display_mode

How to display documents (e.g., list, grid).

display_fields

Which fields to display in the view.

owner

ID of the user who owns this saved view.

user_can_change

Whether the current user can modify this saved view.

Examples

>>> # Create a new saved view for tax documents
>>> tax_view = client.saved_views.create(
...     name="Tax Documents",
...     show_on_dashboard=True,
...     show_in_sidebar=True,
...     filter_rules=[
...         {"rule_type": "document_type", "value": "5"}
...     ]
... )
>>>
>>> # Update an existing saved view
>>> view = client.saved_views.get(3)
>>> view.filter_rules.append({"rule_type": "correspondent", "value": "7"})
>>> view.save()
Parameters:

data (Any)

name: str
show_on_dashboard: bool | None
show_in_sidebar: bool | None
sort_field: str | None
sort_reverse: bool | None
filter_rules: list[SavedViewFilterRuleType]
page_size: int | None
display_mode: SavedViewDisplayModeType | None
display_fields: list[SavedViewDisplayFieldType]
owner: int | None
user_can_change: bool | None
class Meta(model)[source]

Bases: Meta

Metadata for the SavedView model.

This class defines metadata for the SavedView model, including read-only fields and the associated queryset class.

read_only_fields

Set of field names that cannot be modified by the client.

queryset

The queryset class to use for this model.

Parameters:

model (type[_Self])

read_only_fields: ClassVar[set[str]] = {'id', 'owner', 'user_can_change'}
queryset

alias of SavedViewQuerySet

blacklist_filtering_params: ClassVar[set[str]] = {}
field_map: dict[str, str] = {}
filtering_disabled: ClassVar[set[str]] = {}
filtering_fields: ClassVar[set[str]] = {'_resource', 'display_fields', 'display_mode', 'filter_rules', 'id', 'name', 'owner', 'page_size', 'show_in_sidebar', 'show_on_dashboard', 'sort_field', 'sort_reverse', 'user_can_change'}
supported_filtering_params: ClassVar[set[str]] = {'id', 'id__in', 'limit'}
model: type[_Self]
name: str
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