Skip to main content

override_system_checks

Act as a decorator. Override list of registered system checks. Useful when you override INSTALLED_APPS, e.g. if you exclude auth app, you also need to exclude its system checks.

Attributes

AttributeTypeDescription
registry[CheckRegistry](../../../../core/checks/registry/checkregistry.md?sid=django_core_checks_registry_checkregistry)The Django system check registry instance used to manage and trigger validation checks.
new_checksiterableA collection of check functions to be registered as the active system checks during the test context.
deployment_checksiterable = NoneAn optional collection of check functions to override the active deployment-specific system checks.
old_checkssetA backup of the original registered checks used to restore the registry state after the decorator exits.
old_deployment_checkssetA backup of the original deployment checks used to restore the registry state after the decorator exits.

Constructor

Signature

def override_system_checks(
new_checks: list,
deployment_checks: list = None
) - > null

Parameters

NameTypeDescription
new_checkslistThe collection of system checks to be registered.
deployment_checkslist = NoneAn optional collection of deployment-specific checks to be registered.

Signature

def override_system_checks(
new_checks: list,
deployment_checks: list = None
)

Parameters

NameTypeDescription
new_checkslistThe collection of standard system check functions to register in the global registry.
deployment_checkslist = NoneThe collection of deployment-specific check functions to register; if omitted, deployment checks are not modified.

Methods


enable()

@classmethod
def enable()

Backs up the current registered system checks and replaces them with the user-defined set provided to the decorator.


disable()

@classmethod
def disable()

Restores the original system checks and deployment checks to the global registry that were present before the decorator was enabled.