Fixed #33930 -- Eased customization of delete_confirmation.html template in the admin.

This commit is contained in:
Jacob Rief 2022-08-18 00:57:24 +02:00 committed by Mariusz Felisiak
parent e3cb8bcb7d
commit aed60aee38
2 changed files with 14 additions and 4 deletions

View File

@ -21,16 +21,21 @@
{% block content %}
{% if perms_lacking %}
{% block delete_forbidden %}
<p>{% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktranslate %}</p>
<ul>{{ perms_lacking|unordered_list }}</ul>
<ul id="deleted-objects">{{ perms_lacking|unordered_list }}</ul>
{% endblock %}
{% elif protected %}
{% block delete_protected %}
<p>{% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktranslate %}</p>
<ul>{{ protected|unordered_list }}</ul>
<ul id="deleted-objects">{{ protected|unordered_list }}</ul>
{% endblock %}
{% else %}
{% block delete_confirm %}
<p>{% blocktranslate with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktranslate %}</p>
{% include "admin/includes/object_delete_summary.html" %}
<h2>{% translate "Objects" %}</h2>
<ul>{{ deleted_objects|unordered_list }}</ul>
<ul id="deleted-objects">{{ deleted_objects|unordered_list }}</ul>
<form method="post">{% csrf_token %}
<div>
<input type="hidden" name="post" value="yes">
@ -40,5 +45,6 @@
<a href="#" class="button cancel-link">{% translate "No, take me back" %}</a>
</div>
</form>
{% endif %}
{% endblock %}
{% endif %}
{% endblock content %}

View File

@ -39,6 +39,10 @@ Minor features
downloading fonts. Additionally, CSS variables are available to more easily
override the default font families.
* The :source:`admin/delete_confirmation.html
<django/contrib/admin/templates/admin/delete_confirmation.html>` template now
has some additional blocks and scripting hooks to ease customization.
:mod:`django.contrib.admindocs`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~