+ def get_object(self, request, *args, **kwargs):
+ """Get any data for later use."""
+ return None
+
+ def get_directory(self):
+ """Directory relative to MEDIA_ROOT. Must end with a slash."""
+ return self.kwargs['path']
+
+ def breadcrumbs(self):
+ """List of tuples (name, url) or just (name,) for breadcrumbs.
+
+ Probably only the last item (representing currently browsed dir)
+ should lack url.
+
+ """
+ directory = self.get_directory()
+ now_path = os.path.dirname(self.request.get_full_path())
+ directory = os.path.dirname(directory)
+ if directory:
+ crumbs = [
+ (os.path.basename(directory),)
+ ]
+ directory = os.path.dirname(directory)
+ now_path = (os.path.dirname(now_path))
+ while directory:
+ crumbs.insert(0, (os.path.basename(directory), now_path+'/'))
+ directory = os.path.dirname(directory)
+ now_path = os.path.dirname(now_path)
+ crumbs.insert(0, ('media', now_path))
+ else:
+ crumbs = [('media',)]
+ return crumbs
+