def get_deleted_objects(self, request, queryset):
collector = NestedObjects(using=queryset.db)<EOL>collector.collect(queryset)<EOL>model_perms_needed = set()<EOL>object_perms_needed = set()<EOL>STRONG_DELETION_CONTROL = getattr(settings, '<STR_LIT>', False)<EOL>def format_callback(obj):<EOL><INDENT>has_admin = obj.__class__ in self.admin_site._registry<EOL>opts = obj._meta<EOL>no_edit_link = '<STR_LIT>' % (capfirst(opts.verbose_name),<EOL>force_text(obj))<EOL>admin_url = None<EOL>try:<EOL><INDENT>admin_url = reverse('<STR_LIT>'<EOL>% (self.admin_site.name,<EOL>opts.app_label,<EOL>opts.model_name),<EOL>None, (quote(obj._get_pk_val()),))<EOL><DEDENT>except NoReverseMatch:<EOL><INDENT>pass<EOL><DEDENT>if STRONG_DELETION_CONTROL or has_admin:<EOL><INDENT>if not obj.__class__._meta.auto_created:<EOL><INDENT>manager = AccessManager(obj.__class__)<EOL>if manager.check_deleteable(obj.__class__, request) is False:<EOL><INDENT>model_perms_needed.add(opts.verbose_name)<EOL><DEDENT>if not manager.apply_deleteable(obj.__class__._default_manager.filter(pk=obj.pk), request):<EOL><INDENT>object_perms_needed.add(obj)<EOL><DEDENT><DEDENT><DEDENT>if admin_url:<EOL><INDENT>return format_html('<STR_LIT>',<EOL>capfirst(opts.verbose_name),<EOL>admin_url,<EOL>obj)<EOL><DEDENT>else:<EOL><INDENT>return no_edit_link<EOL><DEDENT><DEDENT>to_delete = collector.nested(format_callback)<EOL>protected = [format_callback(obj) for obj in collector.protected]<EOL>protected = set([format_callback(obj) for obj in object_perms_needed]).union(protected)<EOL>model_count = {model._meta.verbose_name_plural: len(objs) for model, objs in collector.model_objs.items()}<EOL>return to_delete, model_count, model_perms_needed, protected<EOL>
Find all objects related to instances of ``queryset`` that should also be deleted.

Returns
    - to_delete - a nested list of strings suitable for display in the template with the ``unordered_list`` filter.
    - model_count - statistics for models of all deleted instances
    - perms_needed - list of names for all instances which can not be deleted because of not enough rights
    - protected - list of names for all objects protected for deletion because of reference type