def get_deleted_objects(objs, opts, user, admin_site, using):
 collector = NestedObjects(using=using)
 collector.collect(objs)
 perms_needed = set()
 def format_callback(obj):
  has_admin = (obj.__class__ in admin_site._registry)
  opts = obj._meta
  if has_admin:
   admin_url = reverse((u'%s:%s_%s_change' % (admin_site.name, opts.app_label, opts.model_name)), None, (quote(obj._get_pk_val()),))
   p = (u'%s.%s' % (opts.app_label, get_permission_codename(u'delete', opts)))
   if (not user.has_perm(p)):
    perms_needed.add(opts.verbose_name)
   return format_html(u'{0}: <a href="{1}">{2}</a>', capfirst(opts.verbose_name), admin_url, obj)
  else:
   return (u'%s: %s' % (capfirst(opts.verbose_name), force_text(obj)))
 to_delete = collector.nested(format_callback)
 protected = [format_callback(obj) for obj in collector.protected]
 return (to_delete, perms_needed, protected)

def get_deleted_objects ( objs , opts , user , admin_site , using ) : collector = NestedObjects ( using = using ) collector . collect ( objs ) perms_needed = set ( ) def format_callback ( obj ) : has_admin = ( obj . __class__ in admin_site . _registry ) opts = obj . _meta if has_admin : admin_url = reverse ( ( u'%s:%s_%s_change' % ( admin_site . name , opts . app_label , opts . model_name ) ) , None , ( quote ( obj . _get_pk_val ( ) ) , ) ) p = ( u'%s.%s' % ( opts . app_label , get_permission_codename ( u'delete' , opts ) ) ) if ( not user . has_perm ( p ) ) : perms_needed . add ( opts . verbose_name ) return format_html ( u'{0}: <a href="{1}">{2}</a>' , capfirst ( opts . verbose_name ) , admin_url , obj ) else : return ( u'%s: %s' % ( capfirst ( opts . verbose_name ) , force_text ( obj ) ) ) to_delete = collector . nested ( format_callback ) protected = [ format_callback ( obj ) for obj in collector . protected ] return ( to_delete , perms_needed , protected )
find all objects related to objs that should also be deleted .