{# @description The Django messages list, rendered as stacked toast alerts. A message can carry one action, a link or a button written into its extra_tags by mvp.utils.action_tags; it stays until it is used or dismissed, and one without an action hides itself after delay. #} {# @prop dismissible:boolean | description:"Add a dismiss button to each message. A message with an action always has one." #} {# @prop :delay:number | default:2000 | description:"Auto-dismiss delay in milliseconds, for a message with no action." #} {# @prop oob:text | description:"The value of hx-swap-oob. Pass oob=\"true\" on the list an htmx response carries, and htmx replaces the list already in the page, found by its id, without a page load." #} {% load mvp %} {% for message in messages %} {# The alert has four variants. Debug is shown as info, and any other #} {# level tag, such as one a project adds, draws a plain alert. #} {% with tag=message.level_tag action=message|message_action %} {{ message }} {% if action.method == "post" %}
{% csrf_token %} {{ action.label }}
{% elif action %} {{ action.label }} {% endif %}
{% endwith %} {% endfor %}