2022-01-05 11:23:11 -05:00
|
|
|
{% load form_helpers %}
|
2023-07-29 03:30:25 +07:00
|
|
|
{% load i18n %}
|
2022-01-05 11:23:11 -05:00
|
|
|
|
|
|
|
<form action="{{ form_url }}" method="post">
|
|
|
|
{% csrf_token %}
|
|
|
|
<div class="modal-header">
|
2023-07-29 03:30:25 +07:00
|
|
|
<h5 class="modal-title">{% trans "Confirm Deletion" %}</h5>
|
2022-01-05 11:23:11 -05:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
2023-08-02 14:53:32 -04:00
|
|
|
<p>
|
2023-09-11 16:17:02 -04:00
|
|
|
{% blocktrans trimmed %}
|
2023-08-02 14:53:32 -04:00
|
|
|
Are you sure you want to <strong class="text-danger">delete</strong> {{ object_type }} <strong>{{ object }}</strong>?
|
|
|
|
{% endblocktrans %}
|
|
|
|
</p>
|
2023-11-01 19:13:45 +00:00
|
|
|
{% if dependent_objects %}
|
|
|
|
<p>
|
|
|
|
{% trans "The following objects will be deleted as a result of this action." %}
|
|
|
|
</p>
|
|
|
|
<div class="accordion" id="deleteAccordion">
|
|
|
|
{% for model, instances in dependent_objects.items %}
|
|
|
|
<div class="accordion-item">
|
|
|
|
<h2 class="accordion-header" id="deleteheading{{ forloop.counter }}">
|
|
|
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{{ forloop.counter }}" aria-expanded="false" aria-controls="collapse{{ forloop.counter }}">
|
|
|
|
{% with object_count=instances|length %}
|
|
|
|
{{ object_count }}
|
|
|
|
{% if object_count == 1 %}
|
|
|
|
{{ model|meta:"verbose_name" }}
|
|
|
|
{% else %}
|
|
|
|
{{ model|meta:"verbose_name_plural" }}
|
|
|
|
{% endif %}
|
|
|
|
{% endwith %}
|
|
|
|
</button>
|
|
|
|
</h2>
|
|
|
|
<div id="collapse{{ forloop.counter }}" class="accordion-collapse collapse" aria-labelledby="deleteheading{{ forloop.counter }}" data-bs-parent="#deleteAccordion">
|
|
|
|
<div class="accordion-body p-0">
|
|
|
|
<div class="list-group list-group-flush">
|
|
|
|
{% for instance in instances %}
|
|
|
|
{% with url=instance.get_absolute_url %}
|
|
|
|
<a {% if url %}href="{{ url }}" {% endif %}class="list-group-item list-group-item-action">{{ instance }}</a>
|
|
|
|
{% endwith %}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2022-01-05 11:23:11 -05:00
|
|
|
{% render_form form %}
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
{% if return_url %}
|
2023-07-29 03:30:25 +07:00
|
|
|
<a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
|
2022-01-05 11:23:11 -05:00
|
|
|
{% else %}
|
2023-07-29 03:30:25 +07:00
|
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
2022-01-05 11:23:11 -05:00
|
|
|
{% endif %}
|
2023-07-29 03:30:25 +07:00
|
|
|
<button type="submit" class="btn btn-danger">{% trans "Delete" %}</button>
|
2022-01-05 11:23:11 -05:00
|
|
|
</div>
|
|
|
|
</form>
|