def get_breadcrumbs(url, request=None):
 from rest_framework.reverse import preserve_builtin_query_params
 from rest_framework.views import APIView
 def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen):
  u'\n        Add tuples of (name, url) to the breadcrumbs list,\n        progressively chomping off parts of the url.\n        '
  try:
   (view, unused_args, unused_kwargs) = resolve(url)
  except Exception:
   pass
  else:
   cls = getattr(view, u'cls', None)
   if ((cls is not None) and issubclass(cls, APIView)):
    if ((not seen) or (seen[(-1)] != view)):
     c = cls()
     c.suffix = getattr(view, u'suffix', None)
     name = c.get_view_name()
     insert_url = preserve_builtin_query_params((prefix + url), request)
     breadcrumbs_list.insert(0, (name, insert_url))
     seen.append(view)
  if (url == u''):
   return breadcrumbs_list
  elif url.endswith(u'/'):
   url = url.rstrip(u'/')
   return breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen)
  url = url[:(url.rfind(u'/') + 1)]
  return breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen)
 prefix = get_script_prefix().rstrip(u'/')
 url = url[len(prefix):]
 return breadcrumbs_recursive(url, [], prefix, [])

def get_breadcrumbs ( url , request = None ) : from rest_framework . reverse import preserve_builtin_query_params from rest_framework . views import APIView def breadcrumbs_recursive ( url , breadcrumbs_list , prefix , seen ) : try : ( view , unused_args , unused_kwargs ) = resolve ( url ) except Exception : pass else : cls = getattr ( view , u'cls' , None ) if ( ( cls is not None ) and issubclass ( cls , APIView ) ) : if ( ( not seen ) or ( seen [ ( - 1 ) ] != view ) ) : c = cls ( ) c . suffix = getattr ( view , u'suffix' , None ) name = c . get_view_name ( ) insert_url = preserve_builtin_query_params ( ( prefix + url ) , request ) breadcrumbs_list . insert ( 0 , ( name , insert_url ) ) seen . append ( view ) if ( url == u'' ) : return breadcrumbs_list elif url . endswith ( u'/' ) : url = url . rstrip ( u'/' ) return breadcrumbs_recursive ( url , breadcrumbs_list , prefix , seen ) url = url [ : ( url . rfind ( u'/' ) + 1 ) ] return breadcrumbs_recursive ( url , breadcrumbs_list , prefix , seen ) prefix = get_script_prefix ( ) . rstrip ( u'/' ) url = url [ len ( prefix ) : ] return breadcrumbs_recursive ( url , [ ] , prefix , [ ] )
get breadcrumbs .