CheckMessage
This class represents a message generated by the system check framework, encapsulating details such as severity level, a descriptive message, an optional hint, and the related object. It provides functionality to determine if a message is serious enough to halt operations or if it has been silenced via configuration. The class also includes a formatted string representation for clear reporting of check results.
Attributes
| Attribute | Type | Description |
|---|---|---|
| level | int | An integer representing the severity of the check message used to determine if the issue is serious enough to halt operations. |
| msg | string | A string containing the primary description of the issue or informative message being reported. |
| hint | string = None | An optional string providing actionable advice or a suggested fix to resolve the reported issue. |
| obj | object = None | The specific object, such as a model or field, that is the source of the check message. |
| id | string = None | A unique identifier string for the check, used to categorize the message and allow for silencing specific checks via settings. |
Constructor
Signature
def CheckMessage(
level: int,
msg: str,
hint: str = None,
obj: object,
id: str = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| level | int | The severity level of the check message. |
| msg | str | The main message text. |
| hint | str = None | An optional hint providing more details on how to fix the issue. |
| obj | object | The object that caused the message to be generated. Defaults to None. |
| id | str = None | A unique identifier for the check message. |
Methods
is_serious()
@classmethod
def is_serious(
level: integer = ERROR
) - > boolean
Checks if the message's severity level meets or exceeds a specified threshold.
Parameters
| Name | Type | Description |
|---|---|---|
| level | integer = ERROR | The severity threshold to compare against the message's current level. |
Returns
| Type | Description |
|---|---|
boolean | True if the message level is greater than or equal to the provided threshold level. |
is_silenced()
@classmethod
def is_silenced() - > boolean
Determines whether the message should be suppressed based on the project's SILENCED_SYSTEM_CHECKS setting.
Returns
| Type | Description |
|---|---|
boolean | True if the message's ID is present in the silenced checks configuration, False otherwise. |