diff --git a/django/contrib/admin/actions.py b/django/contrib/admin/actions.py index 158c436c71..3a841bb6c8 100644 --- a/django/contrib/admin/actions.py +++ b/django/contrib/admin/actions.py @@ -33,7 +33,7 @@ def delete_selected(modeladmin, request, queryset): # Populate deletable_objects, a data structure of all related objects that # will also be deleted. - deletable_objects, perms_needed, protected = get_deleted_objects( + deletable_objects, model_count, perms_needed, protected = get_deleted_objects( queryset, opts, request.user, modeladmin.admin_site, using) # The user has already confirmed the deletion. @@ -67,6 +67,7 @@ def delete_selected(modeladmin, request, queryset): "title": title, "objects_name": objects_name, "deletable_objects": [deletable_objects], + "model_count": dict(model_count), 'queryset': queryset, "perms_lacking": perms_needed, "protected": protected, diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index f304be0b81..3b429fbaed 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1606,7 +1606,7 @@ class ModelAdmin(BaseModelAdmin): # Populate deleted_objects, a data structure of all related objects that # will also be deleted. - (deleted_objects, perms_needed, protected) = get_deleted_objects( + (deleted_objects, model_count, perms_needed, protected) = get_deleted_objects( [obj], opts, request.user, self.admin_site, using) if request.POST: # The user has already confirmed the deletion. @@ -1631,6 +1631,7 @@ class ModelAdmin(BaseModelAdmin): object_name=object_name, object=obj, deleted_objects=deleted_objects, + model_count=dict(model_count), perms_lacking=perms_needed, protected=protected, opts=opts, diff --git a/django/contrib/admin/templates/admin/delete_confirmation.html b/django/contrib/admin/templates/admin/delete_confirmation.html index 6487280d3a..c3816408df 100644 --- a/django/contrib/admin/templates/admin/delete_confirmation.html +++ b/django/contrib/admin/templates/admin/delete_confirmation.html @@ -30,6 +30,8 @@ {% else %}
{% blocktrans 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:{% endblocktrans %}
+ {% include "admin/includes/object_delete_summary.html" %} +