Skip to main content

add_message

Attempt to add a message to the request using the 'messages' app.

def add_message(
request: HttpRequest,
level: int,
message: str,
extra_tags: str = "",
fail_silently: bool = False
) - > None|Any

Attempt to add a message to the request using the 'messages' app.

Parameters

NameTypeDescription
requestHttpRequestThe HttpRequest object to which the message will be attached.
levelintAn integer representing the message level (e.g., DEBUG, INFO, SUCCESS, WARNING, ERROR).
messagestrThe actual content of the message to be displayed to the user.
extra_tagsstr = ""A string containing extra custom CSS classes or identifiers to apply to the message.
fail_silentlybool = FalseIf True, suppresses the MessageFailure exception when the messages middleware is not configured.

Returns

TypeDescription
`NoneAny`