From eafda8550800a98aa37571df0cef78e32521a89b Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 24 May 2011 10:40:35 +0100 Subject: Fix up breadcrumbs to only breadcrumb for REST framework Views --- djangorestframework/utils/breadcrumbs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'djangorestframework/utils') diff --git a/djangorestframework/utils/breadcrumbs.py b/djangorestframework/utils/breadcrumbs.py index 1e604efc..0b043c78 100644 --- a/djangorestframework/utils/breadcrumbs.py +++ b/djangorestframework/utils/breadcrumbs.py @@ -4,6 +4,8 @@ from djangorestframework.utils.description import get_name def get_breadcrumbs(url): """Given a url returns a list of breadcrumbs, which are each a tuple of (name, url).""" + from djangorestframework.views import View + def breadcrumbs_recursive(url, breadcrumbs_list): """Add tuples of (name, url) to the breadcrumbs list, progressively chomping off parts of the url.""" @@ -12,7 +14,8 @@ def get_breadcrumbs(url): except: pass else: - if callable(view): + # Check if this is a REST framework view, and if so add it to the breadcrumbs + if isinstance(getattr(view, 'cls_instance', None), View): breadcrumbs_list.insert(0, (get_name(view), url)) if url == '': -- cgit v1.2.3