Skip to main content

get_deleted_objects

Find all objects related to objs that should also be deleted. objs must be a homogeneous iterable of objects (e.g. a QuerySet).

Return a nested list of strings suitable for display in the
template with the ``unordered_list``
and ``truncated_unordered_list`` filters.
def get_deleted_objects(
objs: iterable,
request: HttpRequest,
admin_site: AdminSite
) - > tuple

Find all objects related to objs that should also be deleted. objs must be a homogeneous iterable of objects (e.g. a QuerySet).

Parameters

NameTypeDescription
objsiterableA homogeneous collection of Django model instances (typically a QuerySet) to be evaluated for deletion.
requestHttpRequestThe current HTTP request object used to verify user permissions for deleting related objects.
admin_siteAdminSiteThe Django AdminSite instance used to check model registration and generate administrative URLs for the objects.

Returns

TypeDescription
tupleA four-item tuple containing: a nested list of formatted strings for display, a dictionary mapping model names to counts of objects to be deleted, a set of verbose model names for which the user lacks delete permissions, and a list of strings representing protected objects that cannot be deleted.