Breadcrumb resolving¶
Simple crumb ressource model to contain all datas about a ressource.
Resolve given path as breadcrumbs
Parameters: root_urlconf (string) – Python path to an url conf file, usually settings.ROOT_URLCONF
. It will be used as the url map to resolve every given path.Cut given path into segments
Parameters: path (string) – An url path like /foo/bar/
.Returns: List of path segments, each segment is a part of the url path starting from /
and ending on the full path.Such as for
/foo/bar/
segments will be:- / - /foo - /foo/bar
Return type: list
Manage title format
Parameters: - name (string) – Url name.
- value (string) – Crumb value.
Keyword Arguments: request (django.http.request.HttpRequest) – Optional Django request object used with custom crumb function. If not given, crumb functions is ignored (so the crumb ressource still be available).
Returns: Crumb title.
Return type: string
Return current Breadcrumb from elements.
This is pretty simple as the current element is allways the last element (if element list is not empty).
Parameters: elements (list) – List of breadcrumb elements. Returns: The last element from given elements
if any, else None.Return type: BreadcrumbRessource or None
Return resolved breadcrumbs datas from given path.
Cut the path in segments and check each of them to find breadcrumb details if any.
Crumb value can be a simple string, a Django lazy unicode or a tuple
(title, custom_function)
.Crumb
custom_function
take url name and request object as arguments and will returnFalse
to ignore crumb (won’t be in breadcrumbs) orTrue
to keep crumb element.Parameters: path (string) – An url path like /foo/bar/
.Keyword Arguments: request (django.http.request.HttpRequest) – Optional Django request object used with custom crumb function. If not given, crumb functions will be ignored (so the crumb ressources still be available). Returns: Datas from resolved crumbs: autobreadcrumbs_elements
: Resolved bread crumbs for each segment;autobreadcrumbs_current
: Breadcrumb for current (the last one) path.
Return type: Dict