mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-20 00:56:26 +00:00
Feature: app branding (#5357)
This commit is contained in:
@@ -8,13 +8,11 @@ from paperless.models import ApplicationConfiguration
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class OutputTypeConfig:
|
||||
class BaseConfig:
|
||||
"""
|
||||
Almost all parsers care about the chosen PDF output format
|
||||
"""
|
||||
|
||||
output_type: str = dataclasses.field(init=False)
|
||||
|
||||
@staticmethod
|
||||
def _get_config_instance() -> ApplicationConfiguration:
|
||||
app_config = ApplicationConfiguration.objects.all().first()
|
||||
@@ -24,6 +22,15 @@ class OutputTypeConfig:
|
||||
app_config = ApplicationConfiguration.objects.all().first()
|
||||
return app_config
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class OutputTypeConfig(BaseConfig):
|
||||
"""
|
||||
Almost all parsers care about the chosen PDF output format
|
||||
"""
|
||||
|
||||
output_type: str = dataclasses.field(init=False)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
app_config = self._get_config_instance()
|
||||
|
||||
@@ -86,3 +93,19 @@ class OcrConfig(OutputTypeConfig):
|
||||
user_args = {}
|
||||
|
||||
self.user_args = user_args
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class GeneralConfig(BaseConfig):
|
||||
"""
|
||||
General application settings that require global scope
|
||||
"""
|
||||
|
||||
app_title: str = dataclasses.field(init=False)
|
||||
app_logo: str = dataclasses.field(init=False)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
app_config = self._get_config_instance()
|
||||
|
||||
self.app_title = app_config.app_title or None
|
||||
self.app_logo = app_config.app_logo.url if app_config.app_logo else None
|
||||
|
Reference in New Issue
Block a user