{% extends "base.html" %} {#- What a delete would take with it, counted before anything is written. A confirmation that only says "this cannot be undone" asks a question nobody can answer. The one people actually have is what happens to the rows underneath, and that is the difference between a confirmation and a trap. -#} {% macro related_list(groups) %}
{% endmacro %} {% block content %}{{ _("It can be restored from Trash.") if soft_delete else _("This cannot be undone.") }}
{{ _("Delete {name}?", name=label) }}
{# A soft delete does not remove the row, so nothing pointing at it needs to cascade -- the related-records warnings below answer a question that only applies to a delete that actually empties the table. #} {% set protected = [] if soft_delete else related | selectattr("effect", "equalto", "protect") | list %} {% set cascaded = [] if soft_delete else related | selectattr("effect", "equalto", "delete") | list %} {% set cleared = [] if soft_delete else related | selectattr("effect", "equalto", "clear") | list %} {% if protected %} {# The database would refuse this, so the button is not offered. Failing here with a sentence beats failing inside the transaction with a constraint violation nobody can act on. #}{{ _("Remove or reassign these first, then delete this record.") }}
{{ related_list(protected) }}