{% extends "form_view.html" %} {% load i18n %} {% block before_form %} {% comment %} An alert lays its direct children out as columns, so everything each one says goes inside a single element. Splitting a sentence around a puts each fragment in a column of its own and spreads it across the width. {% endcomment %} {% 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 prompt (opt-in) ===== #} {% comment %} The input itself is the form's own bound field, rendered inside the
below. Drawing one here as well gave the page two controls with the same name and id: the user typed into this one, and the one that was posted and validated stayed empty. {% endcomment %} {% blocktrans with val=confirmation_value %}To confirm, type {{ val }} below:{% endblocktrans %} {% endif %} {% endif %} {% endblock before_form %} {% block actions %} {% if not is_protected %} {% if require_confirmation %} {% else %} {% endif %} {% endif %} {% endblock actions %} {% block extra_js %} {% if require_confirmation %} {% endif %} {% endblock extra_js %}