{% extends "form_view.html" %}
{% load i18n %}
{% block before_card %}
{% if next_url %}{% endif %}
{% if is_protected %}
{# ===== Scenario 3: Object is PROTECT-blocked - no delete button ===== #}
{% trans "This record cannot be deleted." %}
{% trans "It is referenced by the following records, which must be removed or updated first:" %}
{% for obj in protected_objects %}
{{ obj }}
{% endfor %}
{% else %}
{# ===== Scenarios 1, 2, 4: Object is safe to delete ===== #}
{% blocktrans %}
You are about to permanently delete this record. This action cannot be undone.
{% endblocktrans %}
{% if related_objects %}
{# ===== Scenario 2: Related-objects summary (opt-in) ===== #}
{% trans "The following related records will also be permanently deleted:" %}
{% for label, objs, overflow in related_objects %}
{% for obj in objs %}
{{ obj }}
{% endfor %}
{% if overflow %}
{% blocktrans %}
… and {{ overflow }} more
{% endblocktrans %}
{% endif %}
{% endfor %}
{% endif %}
{% if require_confirmation %}
{# ===== Scenario 4: Type-to-confirm input (opt-in) ===== #}
{% if form.errors.confirmation %}
{% for error in form.errors.confirmation %}
{{ error }}
{% if not forloop.last %}{% endif %}
{% endfor %}
{% endif %}
{% blocktrans with val=confirmation_value %}To confirm, type {{ val }} below:{% endblocktrans %}
{% endif %}
{% endif %}
{% endblock before_card %}
{% block actions %}
{% if not is_protected %}
{% if require_confirmation %}
{% else %}
{% endif %}
{% endif %}
{% endblock actions %}
{% block extra_js %}
{% if require_confirmation %}
{% endif %}
{% endblock extra_js %}