paperap.models.ui_settings.queryset module
Provide query functionality for UI settings in Paperless-NGX.
This module contains the specialized queryset implementation for interacting with the UI settings endpoint of Paperless-NGX. Unlike most resources that can return multiple objects, UI settings is a singleton resource that always returns exactly one object containing all UI configuration settings.
- class paperap.models.ui_settings.queryset.UISettingsQuerySet(resource, filters=None, _cache=None, _fetch_all=False, _next_url=None, _last_response=None, _iter=None, _urls_fetched=None)[source]
Bases:
StandardQuerySet
[UISettings]Manage queries for UI settings in Paperless-NGX.
Extends StandardQuerySet to handle the singleton nature of UI settings, which always returns exactly one object containing all UI configuration. Unlike typical querysets that can return multiple objects, this queryset is specialized for the unique characteristics of the UI settings endpoint.
- _result_cache
Cache of fetched UI settings objects.
- Type:
list[UISettings] | None
- _last_response
The last response received from the API.
- Type:
ClientResponse | None
- resource
The resource instance associated with the queryset.
- Type:
Resource
- filters
Dictionary of filters to apply to the API request.
- Type:
dict[str
,Any]
- 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)
- count()[source]
Return the count of UI settings objects.
Overrides the standard count method to always return 1 because the UI settings endpoint in Paperless-NGX always returns exactly one object containing all UI configuration settings.
- Returns:
Always returns 1, as there is only one UI settings object.
- Return type:
Literal[1]
Example
`python settings_count = client.ui_settings().count() print(settings_count) # Output: 1 `
- has_permission(value)[source]
Filter UI settings by checking if a specific permission exists.
Creates a filtered queryset that checks whether a specific permission is included in the permissions list. This method is useful for determining if the current user has a particular permission in the Paperless-NGX system.
- Parameters:
value (
str
) – The permission string to check for in the permissions list. Common permissions include “view_document”, “change_document”, etc.- Returns:
A new queryset filtered to include only settings with the specified permission.
- Return type:
Self