Settings

class alliance_platform.core.settings.AlliancePlatformCoreSettingsType[source]

Settings for the core package of the Alliance Platform

These can be set in the Django settings file under the ALLIANCE_PLATFORM key:

ALLIANCE_PLATFORM = {
    "CORE": {
        "PROJECT_DIR": PROJECT_DIR,
    }
}
PROJECT_DIR: Path | str[source]

The root directory of the project

CACHE_DIR: Path | str | None[source]

A directory used for caching. This is used by various packages. If not set, defaults to PROJECT_DIR / '.alliance-platform'

RESOLVE_PERM_NAME: str | Callable[[AppConfig, Model | type[Model] | None, str, bool], str][source]

A function used to resolve a permission name for a model and action. You can set this to function, or an import path to a function. The function should have the signature:

def custom_resolve_perm_name(
    # When `model` is passed, `app_config` will be set to `model._meta.app_config`
    app_config: AppConfig,
    # The model class or instance
    model: Model | type[Model] | None,
    # The name of the action. This can be any string, but common ones for CRUD actions
    # are "create", "update", "detail", "list", "delete".
    action: str,
    # Whether the permission is global (``True``) or per-object (``False``). The
    # default implementation does not make use of this parameter, but a custom
    # implementation may.
    is_global: bool
) -> str: ...

This is used by the resolve_perm_name() function, and is used throughout alliance_platform when a generic default permission is needed for a model or app. You can see default_resolve_perm_name() for an example, and the default used when none is provided.