| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- {% load form_helpers %}
- {% load i18n %}
- <form action="{{ form_url }}" method="post">
- {# Render hidden fields #}
- {% csrf_token %}
- {% for field in form.hidden_fields %}
- {{ field }}
- {% endfor %}
- <div class="modal-header">
- <h5 class="modal-title">{% trans "Confirm Deletion" %}</h5>
- </div>
- <div class="modal-body">
- <p>
- {% blocktrans trimmed %}
- Are you sure you want to <strong class="text-danger">delete</strong> {{ object_type }} <strong>{{ object }}</strong>?
- {% endblocktrans %}
- </p>
- {% if dependent_objects %}
- <p>
- {% trans "The following objects will be deleted as a result of this action." %}
- </p>
- <div class="accordion mb-3" id="deleteAccordion">
- {% for model, instances in dependent_objects.items %}
- {% with object_count=instances|length %}
- <div class="accordion-item">
- <h2 class="accordion-header h4" id="deleteheading{{ forloop.counter }}">
- {# High-cardinality relations (e.g. jobs) are summarized by count and are not #}
- {# expandable, since their instances are intentionally not loaded (see #22812). #}
- {% if instances.count_only %}
- <div class="accordion-button collapsed" style="cursor: default;">
- {{ object_count }}
- {% if object_count == 1 %}{{ model|meta:"verbose_name" }}{% else %}{{ model|meta:"verbose_name_plural" }}{% endif %}
- </div>
- {% else %}
- <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 }}">
- {{ object_count }}
- {% if object_count == 1 %}{{ model|meta:"verbose_name" }}{% else %}{{ model|meta:"verbose_name_plural" }}{% endif %}
- </button>
- {% endif %}
- </h2>
- {% if not instances.count_only %}
- <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>
- {% endif %}
- </div>
- {% endwith %}
- {% endfor %}
- </div>
- {% endif %}
- {# Meta fields #}
- {% if form.changelog_message %}
- <div class="bg-primary-subtle border border-primary rounded-1 pt-3 px-3">
- {% render_field form.changelog_message %}
- </div>
- {% endif %}
- </div>
- <div class="modal-footer">
- {% if return_url %}
- <a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
- {% else %}
- <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
- {% endif %}
- <button type="submit" class="btn btn-danger">{% trans "Delete" %}</button>
- </div>
- </form>
|